2

I need to read the battery current value periodically. On Nexus devices, I do this (in unit uA) by reading

/sys/class/power_supply/battery/current_now

Lollipop (API 21) and higher has an API as well:

BatteryManager bm =(BatteryManager)getSystemService(Context.BATTERY_SERVICE); bm.getIntProperty(BatteryManager.BATTERY_PROPERTY_CURRENT_NOW);

On most devices, this value changes by use. For example, if you change the brightness of the screen, the current drawn from battery changes proportionately. Unfortunately, on the S5, I only see a fixed score of 450 mA. The sign changes from + to - depending on whether the device is charging or not.

Apart from the 2 methods I listed above for reading this figure, I also checked the files

/sys/class/power_supply/battery/batt_current_ua_now

/sys/class/power_supply/sec-fuelgauge/current_now

and got the same results. Further, I verified this using the App Ampere from Play store.

Is the static 450 value by design?

If yes, is there any other way I can read the current value in the way I do on other devices? For example, is there a custom kernel out there that I can flash to fix this feature/bug?

I will update this question once I get my hands on an S6 but please feel free to comment about any Samsung device any of you have tested.

Rahul Murmuria
  • 428
  • 1
  • 3
  • 16

0 Answers0