Android OS high battery drain on wifi - description and possible solutions

Medion

[H]ard|Gawd
Joined
Mar 26, 2012
Messages
1,584
Around the time that I upgraded to ICS over a year ago, I noticed that battery life took a nose-dive when connected to my home network. If I didn't charge the phone overnight, I could expect roughly 1% battery drain every 2 hours in standby, and that was with wifi/bt/gps turned on and wifi connected. But, after the ICS update, this quickly became more like 5% battery drain per hour. After recently replacing my battery and getting much better battery life, but still poor when connected to wifi, I decided that it was time to investigate this issue.

What Phones are Affected? Every Android device utilizing Android 2.3.5 or higher, when paired with certain routers, will exhibit this bug. Brand does not matter. A recent report indicated that HTC is so fed up with Google's lack of attention to this, that HTC themselves is developing a custom kernel to be pushed out to many of their devices running Android 4.2 and up in the future (they would not comment if 4.1 or older devices would get the fix).

Certain Routers? Which ones? There is no comprehensive list. I can confirm that, through my own testing and dealing with others who have the issue, these routers will cause high wifi drain on an Android device;
  • D-Link DIR-655
  • Linksys E4200 v1 and v2
  • Linksys E4500

Why does this happen? This is not in my technical area of expertise. But, from what was explained to me is that these routers send a "nagging" signal to the devices to ensure that they are still connected. This signal causes wakelocks, keeping your phone's CPU ramped up while connected. These wakelocks prevent deep sleep and thus cause higher than normal battery drain.

How do I test to see if I am affected? Fully charge your battery, connect to wifi, and let the phone sit untouched for at least 4 hours (doing this while you sleep is easiest). When you check the phone, take note of remaining battery life, and then what apps are using the battery. If Android OS is on top with an absurd level of usage (IE, 30% or higher, when it should almost always be under 15%), you may be affected. At that point, you should download Betterbatterystats (free version on XDA for registered users). You're looking for a few things here that will confirm that your high Android OS usage is in fact caused by this issue. First, under kernel wakelocks, wlan_rx_wake will be your biggest wakelock contributor. Lastly, under "Other", you'll see awake/deep sleep split likely about 50/50, when it should be more like 90% deep sleep.

Ok, I'm affected, now what? Here's the tricky part. There is no known fixes for this. I'm toying with one that was pretty successful after one night (32% battery drain 2 nights ago without the fix, only 3% over 8.5 hours last night after applying it). However, I need to do some more testing of it to make sure there are no side effects. It's a router-side change. In the meantime, here's some things that I've noticed others doing to varying degrees of success;

-replacing the router with an unaffected one
-going into wifi advanced settings and changing sleep policy to "never" or "when plugged in." This raises overnite data usage on your mobile network, but will extend battery life in this situation.
-using Juice Defender (paid version) to manage wifi usage

I'm going to test my "fix" for at least two more nights. However, if you're affected, impatient, and don't mind possibly messing up your home wireless network, send me a PM and we'll try it on you.
 
The routers you tested are they stock firmware, or were they DD-WRT by the end-user routers? Just curious.

I've found that having certain carrier-overlay-specific-apps on AOSP ROMs can cause unreasonable battery drain....I.e. on the Note 2 S-Voice for example works on AOSP ROMs, but causes battery drain at idle.
 
The routers you tested are they stock firmware, or were they DD-WRT by the end-user routers? Just curious.

Stock, latest available firmware.

've found that having certain carrier-overlay-specific-apps on AOSP ROMs can cause unreasonable battery drain....I.e. on the Note 2 S-Voice for example works on AOSP ROMs, but causes battery drain at idle.

Absolutely. That's why I included the troubleshooting steps. If you have the wlan_rx_wake featuring prominently in wakelocks, then it is this issue. If your wakelocks are caused by a specific app, then the app is the culprit.
 
I don't know if this will help but on my note ii if I set wifi to be always on instead of turn off when asleep I get much better battery life. If I leave it to turn off when asleep it will still wake up alot to check email and who knows what else and I guess have to connect to wifi each time just destroys my battery life.
 
Here's the solution for affected routers. You need to change Beacon and DTIM intervals. Without getting too technical, here's how they work.

Beacon - a rating, in milliseconds, on how often your router sends out a signal to all wireless devices. Default is 100 (as in, 10 times per second).

DTIM interval - how many intervals the router buffers data, so that devices in sleep mode will wake up and catch the information. Default on many affected routers is 1, meaning that the phone wakes up for every bacon, or 10 times per second.

NOTE: If you have a device with 4.2, the device now has a setting to do this automatically within the device instead of on the router. Go to settings > wifi > (hit menu button) advanced > conserve battery on wifi (or something like that).

Apparently there is an issue with Android's wifi where, when it wakes up, it often doesn't go back to sleep. These issues cause constant wakelocks and insane battery drain. So, what we're going to do is change these settings to something more efficient.

If you're on a Netgear or other router, you're on your own. If you're on a Linksys router, click the below link (unless you've changed the default IP):
http://192.168.1.1/Wireless_Advanced.asp

From here, you'll see many hidden settings on some routers. You may have two of each if you have a dual-band router. In that case, you need to change them in both places.

Beacon Interval should be reduced to 50. This may seem counterintuitive, but your phone, if it mistimes waking for a beacon, will stay awake until the next beacon. This cuts that wake time in half, thus conserving battery.

Now, change your DTIM to 20 or 30. This means that your phone will wake every 1.0-1.5 seconds to catch the interval. I do not recommend going lower than 6 (which will still suck your battery), or much higher than 30. I have tried it at 255, the max, and it gave INSANE battery life. However, it caused connectivity issues on the network as the router had to buffer data for 25.5 seconds (I had beacon at 100 still). Stick with 20 or 30 at first, and adjust from there. Go lower if you have connectivity issues on your network, but go higher if your connectivity is fine and you want better battery life.
 
I just checked the beacon and DTIM interval on my ol'WRT54G running DD-WRT and it's at the default values you mentioned (100 and 1 respectively). I never had any sleeping issues on my Gnex on WiFi, in fact I remember when I first got it, my Gnex would only lose about 1%/hour on ICS. But it seemed to lose a bit more than that as the phone got older and I put other ROMs/apps on it and when it updated to 4.1. I never payed way too much attention to it really after I had it for the first few months.

But now I notice that my Note 2 doesn't sleep well at all, or at least not nearly as well as my Gnex did, losing at least 4-5%/hour it seems (I haven't really measured it yet, maybe I'll leave it off charge tonight to see) and that's actually a lot of drain for a phone that has over 1/3 more battery capacity than the Gnex and has a more power efficient SoC.

I'm not sure how it's the WiFi affecting it though if my Gnex didn't have the issue when I first got it and I've never touched those settings on my router before. I'm not sure I want to mess with it with all the wireless devices I have on my network at any one time (multiple laptops/desktop, tablets, phones, TVs, game consoles, etc.). I've always figured it was just some background service keeping the phone awake, but battery life still isn't a big issue on the Note 2, so I haven't cared much to investigate it yet. I think it may be my SD card dying because I'm constantly getting notifications about it being unmounted/mounted and that it's failing and I need to re-format it (I just put a RMA in with SanDisk, so I can send it back in the next few days). Since that's been happening, I've seen "media" using a lot of battery in the stock Android battery usage meter and I know that service is responsible for scanning the SD card for new media when it's connected, so I think it's constantly re-scanning my SD card every time I wake up the phone. I'll see how it does with my old 16GB SD card while I wait for my new replacement card.
 
I just checked the beacon and DTIM interval on my ol'WRT54G running DD-WRT and it's at the default values you mentioned (100 and 1 respectively). I never had any sleeping issues on my Gnex on WiFi, in fact I remember when I first got it, my Gnex would only lose about 1%/hour on ICS. But it seemed to lose a bit more than that as the phone got older and I put other ROMs/apps on it and when it updated to 4.1. I never payed way too much attention to it really after I had it for the first few months.

But now I notice that my Note 2 doesn't sleep well at all, or at least not nearly as well as my Gnex did, losing at least 4-5%/hour it seems (I haven't really measured it yet, maybe I'll leave it off charge tonight to see) and that's actually a lot of drain for a phone that has over 1/3 more battery capacity than the Gnex and has a more power efficient SoC.

I'm not sure how it's the WiFi affecting it though if my Gnex didn't have the issue when I first got it and I've never touched those settings on my router before. I'm not sure I want to mess with it with all the wireless devices I have on my network at any one time (multiple laptops/desktop, tablets, phones, TVs, game consoles, etc.). I've always figured it was just some background service keeping the phone awake, but battery life still isn't a big issue on the Note 2, so I haven't cared much to investigate it yet. I think it may be my SD card dying because I'm constantly getting notifications about it being unmounted/mounted and that it's failing and I need to re-format it (I just put a RMA in with SanDisk, so I can send it back in the next few days). Since that's been happening, I've seen "media" using a lot of battery in the stock Android battery usage meter and I know that service is responsible for scanning the SD card for new media when it's connected, so I think it's constantly re-scanning my SD card every time I wake up the phone. I'll see how it does with my old 16GB SD card while I wait for my new replacement card.

What ROM are you running on your Note2? A stock-ish TWiz ROM or an AOSP ROM?

Twiz ROMs can have incredible battery life...AOSP ROMs on the same device, much less so. All else equal.
 
What ROM are you running on your Note2? A stock-ish TWiz ROM or an AOSP ROM?

Twiz ROMs can have incredible battery life...AOSP ROMs on the same device, much less so. All else equal.

I only use TW ROMs, right now I'm using CleanROM ACE 4.8, I was using Beans for the last several revisions before I switched to CleanROM, now I'm about to install Jedi-X on it since I've been seeing a lot of recommendations for it too.

I don't think it's the ROM though, I'm pretty sure its my dying SD card doing it. Like I said, my Gnex on stock Android and other AOSP ROMs was only draining like 1%/hour when I had it.
 
Any word on this?

SBrissen has come up with a patch that is being tested to fix wakelock issues wrt modem.
 
Back
Top