Ampere shows us the value of current made available to the system by the kernel. I used three devices with different Android versions to test my answer. Here we go!
Test 1 & 2: Two MTK devices running stock Android 4.2.1 and 4.4.2
Since MTK is involved, thing would behave a bit differently. In both the devices Ampere had trouble measuring the current not because it couldn't, but two files were available to measure the current, and the user had to choose one from its Settings → Basic settings → Measurement interface. (Rant: A design flaw I tend to think since I wasn't aware of that before digging it up).
The two files for my Android 4.2.1:
/sys/device/platform/mt6320-battery/power_supply/battery/BatteryAverageCurrent
/sys/class/power_supply/battery/BatteryAverageCurrent
The two files for my Android 4.4.2:
/sys/device/platform/battery/power_supply/battery/BatteryAverageCurrent
/sys/class/power_supply/battery/BatteryAverageCurrent
The file BatteryAverageCurrent
would show a numeric value with no mention of any unit (be it A
or mA
).
In my devices, both the files (second was the symlink of the first) had the same value (dynamic, Current varies of course) like 440
when connected to PC, and 880
when connected to charger. Correspondingly, Ampere showed the similar value with a slight mismatch of +- 1-10
mA. // Somebody on XDA said that this app doesn't show true values, but that's none of my concern honestly.
Test 3: A Qualcomm device running Android 5.0.2 (CyanogenOS 12)
I read that Google made changes in Lollipop related to measurement of current, and among other things, BatteryAverageCurrent
is nowhere to be found in the system, at least not in my system. Don't blame me since I didn't verify whether the changes were introduce in Lollipop or before, and it's not really a concern to test the things here.
Before I tell the tale further I should mention that Ampere had no trouble in this device even though there were two files to measure current:
/sys/devices/00-qcom,charger/power_supply/battery/current_now
/sys/class/power_supply/battery/current_now
Not to mention that the second one is the symlink of the first one, and 00-qcom,charger
may differ in your device.
Anyhow, when it comes to the content of the current_now
you can consider everything same as in BatteryAverageCurrent
except that the value was in negative like -180
or -840
(don't ask me why?)
There's more
The last directory named battery
has some other cool stuff which might interest some people. Checkout them like Battery temperature, Voltage, capacity, among other things.
If you want a summary of them, look at uevent
file whose output would be like:
POWER_SUPPLY_NAME=battery
POWER_SUPPLY_CHARGING_ENABLED=1
POWER_SUPPLY_STATUS=Charging
POWER_SUPPLY_CHARGE_TYPE=Unknown
POWER_SUPPLY_HEALTH=Good
POWER_SUPPLY_PRESENT=1
POWER_SUPPLY_ONLINE=1
POWER_SUPPLY_TECHNOLOGY=Li-ion
POWER_SUPPLY_VOLTAGE_MAX_DESIGN=4350000
POWER_SUPPLY_VOLTAGE_MIN_DESIGN=4400000
POWER_SUPPLY_VOLTAGE_NOW=4316000
POWER_SUPPLY_CAPACITY=100
POWER_SUPPLY_CURRENT_NOW=0
POWER_SUPPLY_INPUT_CURRENT_MAX=100000
POWER_SUPPLY_INPUT_CURRENT_TRIM=33
POWER_SUPPLY_INPUT_CURRENT_SETTLED=0
POWER_SUPPLY_VOLTAGE_MIN=4300000
POWER_SUPPLY_INPUT_VOLTAGE_REGULATION=1
POWER_SUPPLY_CHARGE_FULL_DESIGN=0
POWER_SUPPLY_CHARGE_FULL=0
POWER_SUPPLY_TEMP=311
POWER_SUPPLY_TEMP_COOL=0
POWER_SUPPLY_TEMP_WARM=0
POWER_SUPPLY_SYSTEM_TEMP_LEVEL=0
POWER_SUPPLY_CYCLE_COUNT=0
POWER_SUPPLY_CHARGE_NOW=5048
POWER_SUPPLY_FASTCHARGER=0
POWER_SUPPLY_CHARGE_TIMEOUT=1
And if (somehow) you're wondering about 0
in POWER_SUPPLY_CURRENT_NOW=0
then know that POWER_SUPPLY_CAPACITY=100
i.e. charging was complete and even Ampere was showing 0mA
.
As for Logging, sorry! since I've no detailed solution as I didn't bother because the logging can be done using an automation tool like Tasker.
But a brief usage of Tasker must be told:
- Create a profile based on time or the type that suits your goal.
- There are two file actions under the action File namely
Read File
and Write File
. If it doesn't work, then you can always do cat <SOURCE> >> <DESTINATION>
using the action Code → Run Shell and you don't need root access.
We're good to go now!
/sys/class/power_supply/...
. It was easy for me to see the real value inside the file but Lollipop has made some changes so I can't find out which new file holds the value for current. Anyhow, if you do end-up with such file then use Tasker app to log the value for your time period.current_now
made me to rethink about posting. :)