I'm trying to estimate system level power usage from within an ordinary app on a non-rooted Android phone.
There are a variety of apps on the Play store that accomplish this, e.g. GSam Battery Monitor and AccuBattery. So the problem has been solved in principle. As far as I can tell, these applications use the OEM-provided power_profile.xml file (see documentation).
The principle of how the power profile works is clear to me, you can calculate current currant draw by multiplying current system usage of CPU, camera etc. by the respective entry in the profile.
But I don't know how to get this system level usage data from within my app. Where do I get information on whether radio.active
, bluetooth.active
etc? What code do I need to get these values from within an app? I guess the answer is simple, since no one bothers to document it together with the power profile.