Android provides you with some information about how much battery power your apps are consuming. If you go to Settings->Battery, you will find a list of apps, and a percentage for each app.
In the previous post, we described how the percentage value only tells you how much battery is consumed relative to the other apps running on your device.
In actual fact though, it doesn't even tell you this. The problem is that there is no hardware for measuring the power consumption. Instead, Android makes an estimate of the power consumption based on some assumptions and calculations.
These assumptions are specified by the manufacturer of the device, and given as constant values to Android. For example "wifi.scan" tells Android how much power the wifi chip uses when doing a scan. The parameter "cpu.active" tells Android how much power the CPU consumes when it is running. The parameter "screen.on" tells Android how much power the screen consumes when it is on.
So how does Android calculate the power used by an app? It assumes that the longer the app is running, the more power it consumes. So, it measures the total length of time that the app has been running and multiplies this by the power consumption of the cpu ("cpu.active"). This gives us an estimate of the cpu power consumed by the app.
If the app does wifi scanning, then it counts the number of scans and uses the "wifi.scan" parameter to calculate the power consumed by the wifi chip. This is added to the total power consumed by the app.
This sounds all very reasonable, but unfortunately can lead to very confusing results, when the same app on one device suddenly appears to consume much more power when installed on another device.
Let's take an example - the Samsung Galaxy Nexus compared with the Samsung Galaxy S4. The following table lists the values supplied by Samsung, (stored in the "Power Profile" resource file).
In the previous post, we described how the percentage value only tells you how much battery is consumed relative to the other apps running on your device.
In actual fact though, it doesn't even tell you this. The problem is that there is no hardware for measuring the power consumption. Instead, Android makes an estimate of the power consumption based on some assumptions and calculations.
These assumptions are specified by the manufacturer of the device, and given as constant values to Android. For example "wifi.scan" tells Android how much power the wifi chip uses when doing a scan. The parameter "cpu.active" tells Android how much power the CPU consumes when it is running. The parameter "screen.on" tells Android how much power the screen consumes when it is on.
So how does Android calculate the power used by an app? It assumes that the longer the app is running, the more power it consumes. So, it measures the total length of time that the app has been running and multiplies this by the power consumption of the cpu ("cpu.active"). This gives us an estimate of the cpu power consumed by the app.
If the app does wifi scanning, then it counts the number of scans and uses the "wifi.scan" parameter to calculate the power consumed by the wifi chip. This is added to the total power consumed by the app.
This sounds all very reasonable, but unfortunately can lead to very confusing results, when the same app on one device suddenly appears to consume much more power when installed on another device.
Let's take an example - the Samsung Galaxy Nexus compared with the Samsung Galaxy S4. The following table lists the values supplied by Samsung, (stored in the "Power Profile" resource file).
Power consumption | Parameter | Galaxy Nexus | Galaxy S4 |
---|---|---|---|
CPU power | cpu.active | 397 mA | 118 mA |
Wifi scan power | wifi.scan | 100 mA | 120 mA |
Screen power | screen.on | 200 mA | 120 mA |
From the table, it seems the S4 wifi chip consumes 20% more power than the Nexus wifi chip (120 mA vs 100 mA). You might therefore expect the battery consumption of a wifi app to be 20% more on the S4, for example Android would show 6% instead of 5% on the Nexus.
Unfortunately not, the difference is much greater than 20%. This is because when Android does the calculations, it compares the wifi app with other apps that use the cpu intensively and leave the screen on.
Consider the calculation for the Nexus. The cpu activity (397 mA) consumes four times the power of wifi scanning (100 mA), and the Nexus screen (200 mA) consumes twice as much power as wifi scanning. So an app that has a lot of cpu intensive activity, or leaves the screen switched on, is going to consume much more power than an app that only does wifi scanning.
Now let's look at the Samsung Galaxy S4. The parameters are very different. Here, the amount of power consumed by wifi scanning (120 mA) is more than the power consumed by cpu activity (118 mA) and the same as the power consumed by screen on (120 mA)!
A wifi scanning app running on the Nexus compared with the same app running on the S4 appears to consume almost FOUR times the amount of power than an app using cpu power, and TWICE the amount of power than an app that leaves the screen on.
This is of course very misleading, and makes you think that the wifi app on the S4 consumes far far more power than the same wifi app on the Nexus.
As for the accuracy of the parameters given by Samsung, can it really be true that the quad core 1.9ghz cpu of the Galaxy S4 uses less than a third the power of a dual core Galaxy Nexus 1.2ghz, even taking into account the advance of technology? Can it be true that the 1920x1080 display of the Galaxy S4 uses only 60% of the power of the 1280x720 Galaxy Nexus? And yet the wifi uses 20% more power?
A description of the "Power Profiles" can be found here:
https://source.android.com/devices/tech/power.html