Wednesday, August 29, 2012

[GUIDE][Aug 29 2012][NOT SPAM] Enlarge your battery life : an attempt to fix the battery drain

Having an abnormal battery drain on our phone is really frustrating, and finally prevents us from using it normally. Smartphones have a short battery life in general. Do not expect a two weeks-battery life like your old fashioned monochrome Nokia had… But with finding out what’s eating up your battery, and fixing it, you should be able to use your device for about 35-48 hours with ‘normal’ use. This guide will consider you own a Desire HD (even if some advices may be applicable to many other android phones), with a Rom based –at least- on a 1.72.xxx Rom (this base is known for greatly improving battery life over 1.32.xxx based-Roms).

Note to the admins : maybe not in the right section, but questions about this topic often arise in this section... Feel free to move...

It's a bit long and formal, but I tried to be as precise as I could. 


1. Evaluating the battery drain
1.1- Setting up CurrentWidget
1.2- Calibrating the battery
1.3- Monitoring your battery behaviour
2. Finding what is causing the battery drain
3. Fixing the battery drain
3.1- Processes heavy on CPU, GPS, Sensors
3.2- Processes preventing ‘deep sleeping’
3.3- Taskillers
3.4- Radios
4. Battery still draining insanely fast : what to do now ?
5. General tips

1. Evaluating the battery drain

Battery life length is mainly something subjective. You can not compare your battery life to someone else’s, even not with your previous battery cycle. It all comes down to how you use your phone : some activities are known to be real battery hogs (like navigation, watching a movie, recording an HD-clip) and will remain whatever you will do. To eliminate the subjective ‘part’ of our process, we need to measure if you are suffering from an unusual battery drain.
1.1- Setting up CurrentWidget

First, we need to have a measure tool. CurrentWidget will be perfect. Download it and install it off the market. Add the widget to your desktop, and when prompted to configure the widget, tick ‘log file’, you can leave the ‘Update Interval ‘ at 60 seconds.



You end up with a widget that displays the current current (…) in mA (milliampere). Basically, this is the battery flow, measured each minute. More importantly, CurrentWidget generates the file ‘sdcard\currentwidget.log’ which contains the raw measures, with their matching time. This file can be open with any text editor (and most file explorer like ES Explorer, or Root Explorer).
1.2- Calibrating the battery

Then, you should fully charge your battery. Not plug it off when the led turns green, but when Current Widget stops reporting a charge (it slowly decreases). You will see that it takes sometimes more than 1 hour after the green led, to fully charge your battery. If your phone is rooted, delete the file ‘data\system\batterystats.bin’ with a file explorer to reset your battery calibration, and reboot.
1.3- Monitoring your battery behaviour

To evaluate the behavior of your phone, leave it asleep (but not shutdown) a whole night, or at least 2 consecutive hours. Do this with Bluetooth, GPS, and WiFi OFF, data connection ON. Then open the log file. A typical and normal log should look like that :

2011/02/01 03:48:12,-5mA,55%
2011/02/01 03:53:20,-3mA,55%
2011/02/01 03:57:54,-66mA,55%
2011/02/01 04:07:46,-5mA,55%
2011/02/01 04:08:51,-5mA,55%
2011/02/01 04:18:44,-7mA,55%
2011/02/01 04:23:20,-3mA,55%
2011/02/01 04:33:13,-3mA,55%
2011/02/01 04:38:19,-3mA,54%
2011/02/01 04:48:12,-3mA,54%
2011/02/01 04:53:20,-3mA,54%
2011/02/01 04:58:12,-3mA,53%
2011/02/01 05:08:20,-3mA,53%
2011/02/01 05:18:13,-8mA,53%
2011/02/01 05:28:05,-5mA,53%
2011/02/01 05:37:58,-5mA,53%
2011/02/01 05:48:44,-5mA,53%

You see here that the battery drain flow is continually between 3-8 mA, with only one peek at 66 mA. It results in only 2 % battery lost in 2 hours. When in standby, your phone should lose roughly 1 %-charge per hour.

If you can use your phone to heat your lounge and your log look more like this one :

2011/02/01 03:48:12,-164mA,55%
2011/02/01 03:53:20,-225mA,54%
2011/02/01 03:57:54,-147mA,54%
2011/02/01 04:07:46,-213mA,52%
2011/02/01 04:08:51,-110mA,52%
2011/02/01 04:18:44,-236mA,50%
2011/02/01 04:23:20,-189mA,49%
2011/02/01 04:33:13,-264mA,47%
2011/02/01 04:38:19,-235mA,46%
2011/02/01 04:48:12,-199mA,44%
2011/02/01 04:53:20,-236mA,43%

It’s good news ! There is room for improvement !
2. Finding what is causing the battery drain

At this point, you know that something is eating up your battery. The key is to find out which setting or application (or combination of both) is causing this.

Open the dialer and press *#*#4636#*#* or download and install ‘Spare Parts’ and go in ‘Battery History’. In the second box set ‘Total since boot’. Then let’s have a look at the first box settings.

CPU usage :

A reasonable repartition should look like that :


If one or more Items are much more CPU-intensive than others, you have identified the culprit (or at least a part of them).

Proceed the same way with GPS and Sensors usage and look for any abnormal intensive processes.

If at this point you have identified one or more processes, go to point 3.1

Finally select ‘Partial Wake Usage’. If your phone suffers from battery drain, it is likely you will have one or more process(es) over represented in this ‘Partial Wake Usage’. It means these applications or settings (if the main culprit is 'Android System') are preventing your phone from going standby, keeping it in a partial wake state, which is obviously less battery-efficient. In this case, directly go to point 3.2
3. Fixing the battery drain
3.1- Processes heavy on CPU, GPS, Sensors

- If the main processes you identified are 3rd party applications, there is not much to do. Use common sense : for example if the draining culprit is a backup app, try to disable automatic backup, permanent monitoring, or any option that could use your phone even when standby. Each application has its own settings. Ultimately, you should uninstall these apps, and get in touch with the developper to inform him about the issue.

- If the main processes you identified are or is a stock app (ie HTC Sense account, Gmail, etc.) :
. if applicable, you should delete your ‘HTC Sense account’ which is know to be heavy on CPU
. if you identified Gmail, Picasa, or any other Google service, try lowering the synchronization frequency (or disabling it to see if it improves your battery life)
. stock apps can also drain battery when you installed a Rom over a previous one without completely wiping your system. Keep in mind that the results log I presented at the beginning are obtained with synchronization and stock app with their default settings. So on a healthy system, stock apps should not cause battery drain (again, appart from HTC Sense Account which is crap)

At this point, you should repeat point 1 and have a look at your log to see if things have improved. If the answer is ‘No’, go to point 4.
3.2- Processes preventing ‘deep sleeping’

Some apps or settings can prevent your phone from going standby even if screen is off. It means your CPU can still be used at 100 %, and your battery will keep on draining, nearly as if it was awake.

It the process you identified in point 2. is a 3rd party app, there is not much to do. Use common sense : if the draining culprit is a backup app, try to disable automatic backup, permanent monitoring, or any option that could use your phone even when standby. Each application has its own settings. Ultimately, you should uninstall these apps, and get in touch with the developper to inform him about the issue.

Often, you won’t have much information about what is preventing your phone from sleeping. The main process is ‘Android System’. There has been much discussion over the net about this issue.

There has been many cases reported where WiFi when turned on, would keep your phone in ‘Partial Wake’. Even when turned off, the phone would not return to normal behaviour. In this case the only solution is to reboot with WiFi off. This is not a global issue, I did not suffer from it, but take the time to investigate this path. If you confirm you have this issue, there is not known solution yet. I would advice you to go to point 4.

By experience I can also tell you that installing a Rom over a previous one without wiping all can lead to some erratic issues. You should always backup your important data, then wipe all (data, dalvik, cache, etc) and then only install your new Rom. Some backup apps (like Titanium Backup) offer the possibility to save and restore system settings. This can also cause issues. You should only save data (sms, mms, bookmarks…) but not settings.
3.3- Taskillers

If you use a taskiller, simply don’t. Really. Or at least, disable any option that allows the taskiller to permanently monitor and manage your memory.

Taskillers are supposed to speed your phone by killing tasks when the Memory is ‘full’ or above a defined limit. The problem is that it interferes with Android built-in (and efficient) memory management. You have to understand that what can slow down your phone is not Memory saturation (because Android will start closing apps on its own before reaching this situation), but CPU usage. You can still use a taskiller to see which app are eating CPU cycles and close them. But again, don’t let any 3rd-party app manage your memory. It will only bring you force-closes, battery drain, and various unpredictable issues.
3.4- Radios

I won’t be very talkative on this topic, but if your phone is fully rooted, ENG-OFF and Radio S-OFF, you should really try a few radios. Some of them are reported to improve signal strength and battery life. Write down the version of your current radio (to be able to restore it if needed) and try a few ones. Have a look here :

http://alturl.com/myrpe
4. Battery still draining insanely fast : what to do now ?

Ok, at this point, you have not much options left.

If not already done, install a fresh, well-known, and stable Rom (for example LeeDroid or RevolutionHD). Install it from scratch, after having wiped all. When booting and going through the setup steps, untick ‘save my settings with my google account’ (or something similar, sorry my Rom is in French…). This will prevent the Market from restoring the apps you used with your previous Rom.

When fully booted, only install CurrentWidget off the market, reboot, and follow point 1. to calibrate your battery. You are now on stock Rom, with only one app installed (which I certify does not drain battery…).

At this point you should not experience battery drain.

- If you still have an unusual battery consumption, I have no more idea. Get in touch with the relevant Customer Service and ask for a return. You may restore a stock Rom before doing this (for warranty purpose), search the forum to find How.

- If you seem to have a reasonable battery flow (again, between 3 to 8 mA with only a few peaks), install your favourite apps one by one, with at least 30 mn between each installation (and having a look at the current log each time). This will allow you to identify any app that would start draining your battery. If you identify such an app, go to point 3.1. This will take time, but hey, you want your issue solved don’t you ?
5. General tips

Finally, I will try to sum up what to do to preserve your battery life :

- avoid installing a Rom without wiping your system before
- after installing a new Rom, calibrate your battery (point 1.2)
- do not use taskillers
- try to install applications one by one to easily identify a battery-draining one
- don’t use HTC Sense account, it can use much CPU, drain your battery, burn your house and kill your family

0 comments:

Post a Comment

 
© 2011 Android One Developer | Except as noted, this content is licensed under Creative Commons Attribution 2.5.
For details and restrictions, see the Content License | Recode by Ardhiansyam | Based on Android Developers Blog