Wakelocks on WiFI - General Questions and Answers

Moto x 2013, just installed a CM based rom (NX experience).
http://i.imgur.com/rqyvyEo.jpg
Went through a day with WiFi off, ignore the WiFi on at the beginning, it was actually off (Even stock lolipop is full of battery stats bugs anyways). Then I left my phone with wifi on overnight. Ignore the spikes too, no idea why that happens.
BBS shows the cpu at ~700mhz for a good chunk of that time overnight. Nothing seen in kernel wakelocks, partial wakelocks aren't helpful. Sometimes its * alarm *. Sometimes nothing is there. This never happened on stock. Running xposed with powernap/amplify.
I have both 5ghz and 2.4ghz networks and separate routers but same story on both.
Additional screenshots (from a different time):
http://imgur.com/a/wy4be
http://imgur.com/a/MYdPX

That is weird.
@dannygoround

I have same problem with [ROM][N910C/H/U] CyanogenMod 13 - Build 4 by*RaymanFX
Also have GPS on some times
In wifi Advanced I set Keep wifi on during sleep to never, but I have this problem on note 4
Sent from my SM-N910C using Tapatalk

Related

Sporadic 3-5%/hour battery drain - modem to blame?

Problem:
Unreproducible, but consistent 3-5% per hour battery drain. Happens at least a couple times a week. As such, I can rarely get more than 48 hours uptime without seeing it.
Cause:
Unsure of the culprit, I suspect it is the modem. Not sure if it's a software or hardware problem.
Steps to reproduce:
Be lucky? I live in an area with no very little to no data service (cell signal is passable), and I'm on wifi at home. I'm not sure what triggers the battery drain. Maybe it's disconnecting from wifi and struggling to obtain a mobile data connection, doing that a few times is triggering it? Sometimes I can go 72 hours without seeing it, sometimes 12 hours. I do know that it happens much less frequently when I'm on wifi at home, as opposed to mobile data at work. I'll look at my phone, and I'm at 75%, when I should be at 95%+. Battery stats and BBS have nothing to say on the issue.
Fix
Reboot the device. It seems that toggling airplane mode also stops it.
Reproduced on:
Stock ROM 4.4, 4.4.1, 4.4.2
Stock kernel, Franco kernel
Baseband 4.4, 4.4.1 (think that's .17, and .23 respectively).
Has anyone else seen this before?

Real Cause of battery drain/wake lock in MJ7/MK2 and fix

I am posting this as it is very hard to wade through information in forums. I'm hoping the following will be useful to those, who like me, experienced battery drain caused by Android Wake Locks after upgrading to MJ7 / MK2.
I am 100% certain the battery drain in MJ7/MK2 is caused by connecting to WIFI networks in environments that have multiple AP's. i.e. once WIFI roams from one AP to another the battery drain starts. All my testing confirms this - consistently. I have actually tested being connected to one AP in a multiple AP environment for a long period and observed no wake locks on Android OS. Yet as soon I move to another location (i.e when I make it roam) the wake lock and battery drain starts. All this rubbish about clearing cache, factory resetting, nobbling your phone and so on are all stabs in the dark - It's the reboot that temporarily fixes it so people mistakenly put two and two together. So, if you use WIFI in a large building with multiple AP's try forgetting the network and not connecting to WIFI with multiple AP's. If you have already connected to a SSID with multiple AP's reboot your phone because once the battery drain starts it does not seem to stop until you reboot. You don't have to disable WIFI at all as scanning does not cause the wake lock. I have tested this thoroughly and so far I have not had any battery drain since not connecting to SSIDs with multiple APs. I can also back this up as I can create battery drain at will by simply connecting to a WIFI environment with an SSID distributed over multiple AD's.
My battery life is again fantastic and I am happy now that I know the cause.
Pretty poor testing by Samsung/Google as I see in past versions of Android Roaming has been an issue.
mongoose3800 said:
I am posting this as it is very hard to wade through information in forums. I'm hoping the following will be useful to those, who like me, experienced battery drain caused by Android Wake Locks after upgrading to MJ7 / MK2.
I am 100% certain the battery drain in MJ7/MK2 is caused by connecting to WIFI networks in environments that have multiple AP's. i.e. once WIFI roams from one AP to another the battery drain starts. All my testing confirms this - consistently. I have actually tested being connected to one AP in a multiple AP environment for a long period and observed no wake locks on Android OS. Yet as soon I move to another location (i.e when I make it roam) the wake lock and battery drain starts. All this rubbish about clearing cache, factory resetting, nobbling your phone and so on are all stabs in the dark - It's the reboot that temporarily fixes it so people mistakenly put two and two together. So, if you use WIFI in a large building with multiple AP's try forgetting the network and not connecting to WIFI with multiple AP's. If you have already connected to a SSID with multiple AP's reboot your phone because once the battery drain starts it does not seem to stop until you reboot. You don't have to disable WIFI at all as scanning does not cause the wake lock. I have tested this thoroughly and so far I have not had any battery drain since not connecting to SSIDs with multiple APs. I can also back this up as I can create battery drain at will by simply connecting to a WIFI environment with an SSID distributed over multiple AD's.
My battery life is again fantastic and I am happy now that I know the cause.
Pretty poor testing by Samsung/Google as I see in past versions of Android Roaming has been an issue.
Click to expand...
Click to collapse
Funny thing is that when i am using mobile data the drain is worse, So I'm pretty sure this is not the main issue man. Also, I have a Mobile 'WiFi' router. Only me has WiFi connection in my entire hostel. So I don't really think it's the issue. Good finds tho! It will definitely help someone. Cheers!
Agree with stanley, this is not the only cause.
39089665568
vndnguyen said:
Agree with stanley, this is not the only cause.
Click to expand...
Click to collapse
Agreed. There are many things that will cause elevated use. But Im talking the rapid drain that occurs when you're not using the phone. Ever since taking the action I describbed my battery life has been excellent. Eg 94% after 14 odd hours with no use. And, I'm still connecting to my home wifi. Beforehand it could be below 60% with no use and this is the real problem people are talking about. Hope that makes sense.
Actually it's the opposite. If you set up your modem to have a separate AP for the phone and isolate it from the rest of the network, you'll have much better battery life on wifi because you'll stop your phone from waking up by broadcast packets.
aydc said:
Actually it's the opposite. If you set up your modem to have a separate AP for the phone and isolate it from the rest of the network, you'll have much better battery life on wifi because you'll stop your phone from waking up by broadcast packets.
Click to expand...
Click to collapse
I don't get it. What am I supposed to do exactly?
aydc said:
Actually it's the opposite. If you set up your modem to have a separate AP for the phone and isolate it from the rest of the network, you'll have much better battery life on wifi because you'll stop your phone from waking up by broadcast packets.
Click to expand...
Click to collapse
What about unicast traffic? i know the Client Isolation sort of "VLAN"s every client associated, just wondering if that might affect client to client communication?
Good point btw, im also wondering how many services wake the damn thing up, waking up over network is more an enterprise workstation scenario...to me it sounds like HotSpot 2.0 services being active, but i have not enabled it.
HS2.0 can let client and AP sort of talk without associating.
Nazty111 said:
I don't get it. What am I supposed to do exactly?
Click to expand...
Click to collapse
Most modems have a sort of 'guest mode' or allow you to open another access point and isolate it from the rest of the network. If you connect your phone to this guest access point or isolated access point, your phone will reach internet without problems, but will not reach the local network through the router. Nor will any other device on the network reach your phone.
Most of the problems with Wifi draining battery, like wifi wakelocks, occurs because devices on the network keep sending packets to the phone waking it up. With the method I describe above, you will isolate your phone and the phone will remain in deep sleep, significantly increasing battery life.
aydc said:
Most modems have a sort of 'guest mode' or allow you to open another access point and isolate it from the rest of the network. If you connect your phone to this guest access point or isolated access point, your phone will reach internet without problems, but will not reach the local network through the router. Nor will any other device on the network reach your phone.
Most of the problems with Wifi draining battery, like wifi wakelocks, occurs because devices on the network keep sending packets to the phone waking it up. With the method I describe above, you will isolate your phone and the phone will remain in deep sleep, significantly increasing battery life.
Click to expand...
Click to collapse
This is very true. Back on my old GNex i used to have crazy wifi wakelocks and I couldn't for the life of me figure it out. I never figured it out, actually. But I am positive it is one of the two PC's on my network that are broadcasting packets across the network, waking my phone up. I haven't had time to extensively test the wifi wakelock in the environment i've previously encountered it in to see if it still applies, but since I haven't changed anything regarding any of the two computers involved on that network, I'm positive I will have the same wifi wakelock issue when I get back and test. Is there a way (besides using Shark) to see what programs are broadcasting packets across the network?
But to get back on topic, I am experiencing battery drain connected to ONE router with ONE AP. I am in an apartment building with several other routers nearby, though. Maybe they are broadcasting packets somehow that the kernel is interpreting and keeping the phone awake? However it seems as though the Android OS bug keeps coming back for everyone no matter what, even in airplane mode.
Wifi has evolved a lot the last decade, not just by technology standards but into integration as well. carriers use them as small cells, we'll see them more often in the future (malls, stadiums, etc), and HS2.0 adds to make it a bit more seamless, they call it offload, taking your data needs through small wifi cells rather then the macro cells (3g, 4g), hence offload.
my point is that they would have never invested in that if the wifi chips inside consumer products were not efficient enough, so nearby APs shouldnt be a problem at all. But im still puzzled for what would one need the waking up process through wifi?
If Wifi is the general bugger, then somebody throw an eye on the Passport service, thats the consumer name for HS 2.0 services.
PS, tested AP Isolation on my sh!tty WRT120N, no difference unfortuantely.
Will there be a future update from Sammy or will we get Kitkat directly
Sent from my SM-N900 using Tapatalk
Just a follow up. I have still had no battery drain since avoiding connecting to wifi networks that use multiple APs. Now, i only connect to wifi networks where i know there is only one AP. Before I stumbled across this the drain and Android os wake lock was bad, really bad, after I had connected to large wifi networks - I just hadn't put two and two together. This is more than coincidence - my testing is sound and replicable. And, this week I have been in remote areas with weak to no 3g signal and the battery life has still been fantastic and no wake locks so that sort of rules that out - Sure there is a little increase in battery usage but nothing dramatic, something to be expected and certainly not something to complain about. I have seen many claims to fix battery drain but these are just fine tuning and not addressing the major drain caused by Android OS wake locks. Clearly, there must be an issue with the wifi software driver in MJ7/MK2 and I hope Samsung/Google are aware of it. The annoying thing is getting Samsung to acknowledge the issue and take feedback.
I get wake locks even if I manually turn wifi off and only use data. When I use wifi i am connected to only one AP and I still get wake locks. The wake locks aren't apps, they are "Powermanager.wakelocks" and "Powermanager.Display" and show up as "Android OS" in battery settings.
I am still not convinced avoiding multiple AP wifi networks is the one-for-all solution for everyone.
However, I have put "wifi on during sleep" to "never," yet my phone slept maybe 50% yesterday but wifi was on 100% of the time. Why is this? Shouldn't it have turned off the 50% that the phone was sleeping?
Something is weird with the wifi module..
Sent from my SM-N9005 using xda app-developers app
EddieN said:
I get wake locks even if I manually turn wifi off and only use data. When I use wifi i am connected to only one AP and I still get wake locks. The wake locks aren't apps, they are "Powermanager.wakelocks" and "Powermanager.Display" and show up as "Android OS" in battery settings.
I am still not convinced avoiding multiple AP wifi networks is the one-for-all solution for everyone.
However, I have put "wifi on during sleep" to "never," yet my phone slept maybe 50% yesterday but wifi was on 100% of the time. Why is this? Shouldn't it have turned off the 50% that the phone was sleeping?
Something is weird with the wifi module..
Sent from my SM-N9005 using xda app-developers app
Click to expand...
Click to collapse
Have you ruled out any other wifi connections? Have you tried rebooting if you have connected to another wifi network? Have you tried forgetting all wifi networks? Reboot after forgetting all networks. Then give it a couple of days with out connecting to any wifi network - just a test to confirm it is wifi related. I tend to think setting wifi to never on during sleep makes no difference - I had previously tried it too. Once the drain starts the only way to stop it is to reboot.
mongoose3800 said:
Have you ruled out any other wifi connections? Have you tried rebooting if you have connected to another wifi network? Have you tried forgetting all wifi networks? Reboot after forgetting all networks. Then give it a couple of days with out connecting to any wifi network - just a test to confirm it is wifi related. I tend to think setting wifi to never on during sleep makes no difference - I had previously tried it too. Once the drain starts the only way to stop it is to reboot.
Click to expand...
Click to collapse
Yes, just last week I was on another Wifi AP about ~300km away (totally different environment) and I still had the same wake locks. I have rebooted when connecting to another wifi network. I have tried forgetting all wifi networks i have connected to, and reconnecting to them. I have also rebooted once forgetting networks. During this time I also took the liberty of doing the normal rounds of disabling location services etc. before rebooting, but nevertheless i did reboot once forgetting the network. All networks I have been connected to have been single-AP wifi networks.
I have not let it sit for a few days without connecting to any wifi networks. That's the only thing I haven't tried. However I have let it go a whole day with wifi turned off (and only data enabled), but the same wakelocks persisted. For me it's always "Powermanage.Display" and "Powermanager.Wakelocks" no matter how long i just let my phone sit around with the screen turned off. I have it right beside me so I always have visual access to the screen in case the phone wakes up on its own, but it never has. I guess I could try turning wifi off for a few days and seeing how it fares, but I doubt I will see any difference (wake lock wise).
I'm thinking something is strange with the wifi module anyway. Surely wifi should turn off by itself once the phone sleeps, right? Like I said in my other post, my phone slept maybe 50-60% of the time on a 14 hour day. That means Wifi should have been on 40-50% of that time, and off 50-60% since the phone technically should have been sleeping. Yet I can see in the battery settings menu that wifi is a solid green bar all across the 14 hours.
EddieN said:
Yes, just last week I was on another Wifi AP about ~300km away (totally different environment) and I still had the same wake locks. I have rebooted when connecting to another wifi network. I have tried forgetting all wifi networks i have connected to, and reconnecting to them. I have also rebooted once forgetting networks. During this time I also took the liberty of doing the normal rounds of disabling location services etc. before rebooting, but nevertheless i did reboot once forgetting the network. All networks I have been connected to have been single-AP wifi networks.
I have not let it sit for a few days without connecting to any wifi networks. That's the only thing I haven't tried. However I have let it go a whole day with wifi turned off (and only data enabled), but the same wakelocks persisted. For me it's always "Powermanage.Display" and "Powermanager.Wakelocks" no matter how long i just let my phone sit around with the screen turned off. I have it right beside me so I always have visual access to the screen in case the phone wakes up on its own, but it never has. I guess I could try turning wifi off for a few days and seeing how it fares, but I doubt I will see any difference (wake lock wise).
I'm thinking something is strange with the wifi module anyway. Surely wifi should turn off by itself once the phone sleeps, right? Like I said in my other post, my phone slept maybe 50-60% of the time on a 14 hour day. That means Wifi should have been on 40-50% of that time, and off 50-60% since the phone technically should have been sleeping. Yet I can see in the battery settings menu that wifi is a solid green bar all across the 14 hours.
Click to expand...
Click to collapse
Well that's interesting. At least in both cases we know it's Wi Fi. I wonder if it's something if it comes down to the type of connection. Eg 2.4 vs 5ghz
mongoose3800 said:
Well that's interesting. At least in both cases we know it's Wi Fi. I wonder if it's something if it comes down to the type of connection. Eg 2.4 vs 5ghz
Click to expand...
Click to collapse
It could be. Both networks I have been connected to have been 2.4GHz Wireless-N capable routers. I just find it odd that a lot of things don't add up when looking at awake times in Settings -> Battery and comparing it to kernel/partial wakelocks in BBS/WLD/CPU Spy. All of the times seem to be roughly in the same ballpark, but they never add up to correspond to each other. Surely there must be information missing in this regard.
I can confirm the WiFi issue on my N9005 but there's another one.
1. Wifi: I experienced this at my university, where we have good Wifi coverage on the whole campus. They use Radius for logging in. After using Wifi for about 15min, I had these wakelocks, which didn't stop until I rebooted the phone. Since I knew this, I haven't been using Wifi there any more. But: In the meantime, I did a factory reset and got this little stability update. A few days ago, I gave it a try again. Used Wifi at university for ~25min and hat no issues. Maybe it's gone, I will test again some day.
2. I had an app called "gentle alarm". On my GNexus, which I used before my Note 3, I also had wakelocks, but couldn't figure out what it was, since wakelock detector, better battery stats etc. didn't show more than PowermanagerService.Wakelocks/Display. So I got my new Note 3 and still had these Wakelocks - I did much Monitoring and: It was this tiny alarm app. Very funny: After having excluded every other possibility and having the wakelocks active I uninstalled the app on my Note 3 and it instantly rebooted!
Great battery life now.
Hope this helps someone. BTW: The Wifi issue on larger networks seems to be a problem not only on Samsung phones, many people are experiencing this (e.g. found similar reports for Nexus 5...).
duffmannr3 said:
I can confirm the WiFi issue on my N9005 but there's another one.
1. Wifi: I experienced this at my university, where we have good Wifi coverage on the whole campus. They use Radius for logging in. After using Wifi for about 15min, I had these wakelocks, which didn't stop until I rebooted the phone. Since I knew this, I haven't been using Wifi there any more. But: In the meantime, I did a factory reset and got this little stability update. A few days ago, I gave it a try again. Used Wifi at university for ~25min and hat no issues. Maybe it's gone, I will test again some day.
2. I had an app called "gentle alarm". On my GNexus, which I used before my Note 3, I also had wakelocks, but couldn't figure out what it was, since wakelock detector, better battery stats etc. didn't show more than PowermanagerService.Wakelocks/Display. So I got my new Note 3 and still had these Wakelocks - I did much Monitoring and: It was this tiny alarm app. Very funny: After having excluded every other possibility and having the wakelocks active I uninstalled the app on my Note 3 and it instantly rebooted!
Great battery life now.
Hope this helps someone. BTW: The Wifi issue on larger networks seems to be a problem not only on Samsung phones, many people are experiencing this (e.g. found similar reports for Nexus 5...).
Click to expand...
Click to collapse
Thanks for your input. Is the wifi issue you are talking about the fact that it doesnt turn off when having "wifi on during sleep -> never" set? Or the multiple-AP issue the thread is talking about?
What stability update is it that you have received? What country are you in and what firmware are you using? Did you get this stability update while on MJ7/MK2 firmware? I haven't received any notification for a stability update OTA...
Thanks for the Powermanager.Display/Wakelock issue. I guess I will have to sift through my apps and uninstall each, one by one, to see if the wakelocks disappear. If not, there is some other issue
EddieN said:
Is the wifi issue you are talking about the fact that it doesnt turn off when having "wifi on during sleep -> never" set? Or the multiple-AP issue the thread is talking about?
Click to expand...
Click to collapse
It's the issue about "multiple" APs, but I don't think that it is about the number of APs. What I have read is that there is so much traffic on those big networks, e.g. broadcasts from other devices. I don't know how it should be with your problem that wifi doesn't turn off - can you see if it's reconnecting after some standby time? If yes, then wifi is turned off during sleep, but is just not shown in statistics.
EddieN said:
What stability update is it that you have received? What country are you in and what firmware are you using? Did you get this stability update while on MJ7/MK2 firmware? I haven't received any notification for a stability update OTA...
Click to expand...
Click to collapse
I'm currently on MJ7/MK2. My device is unbranded and I'm living in Germany. It came on 26th of December and was about 30MB or so.
EddieN said:
Thanks for the Powermanager.Display/Wakelock issue. I guess I will have to sift through my apps and uninstall each, one by one, to see if the wakelocks disappear. If not, there is some other issue
Click to expand...
Click to collapse
It's definitely worth a try! There was absolutely no hint that pointed to this one app. I started with having a look at the battery statistics ~every 30min after a fresh reboot. After a few days it was clear that it only could be the alarm app, battery draining started only in the morning.

[Q] [Android 5.02] Notifications won't arrive while on WiFi only

I'm writing this in General Section, beause it seems like this is related to Lollipop rather than device dependant. I am facing this issue since using 5.0, while there were never any problems on KitKat. The devices of some friends show similar behaviour. For your Interest: I'm running an OnePlus One with CM12 based Android 5.02 and latest Google Play Services.
Usually i switch on WiFi and disable mobile data manually while at home. It turns out that i don't receive any Push Notifications like WhatsApp, Threema, Facebook and GMail/Inbox (those who are using gcm) when the device is connected to WiFi only and goes into deep sleep. If i unlock the device after a certain amount of time, a bunch of notifications are popping up. This is reproducable and won't occur if only mobile data is enabled. In this case they arrive instantly. I've worked around this issue by setting "Keep WiFi on during sleep" to "never", so that WiFi is only active if the screen is turned on, but this isn't really a satisfying solution.
For me it seems like my device turns WiFi to sleep too if screen turns off, although this isn't visible through Battery Stats, where WiFi is shown as active the whole time, or at least disables any sync service meanwhile. I've tested this with a couple of AOSP and CM based ROMS and different Kernels. I've even tried older Google Play Services. Passing on denying "Wake up" and "Keep Awake" to Google Play Services, as i usually do to limit battery drain, won't change anything.
Anyone else got kinda issues and can enlighten me about what's the culprit or if this has been fixed with Android 5.1?
Okay, flashed unofficial CM12.1 to take a look if some messed up things in CM12, or Lollipop 5.02 in general, could be the culprit and maybe was fixed with 5.1. But won't work anyway, still no device wakeup from push messages of any kind. Reverted back (coz i'm so adventurous) to CM11s KitKat (4.44) and problem was still present, until i've toggled off WiFi Optimizations. From this point all notifications are received instantly, without any delay through WiFi.
I'm curious, coz afaik there is no Option like WiFi Optimization in Lollipop, at least not on the CM12(.1) based Roms for the OnePlus. But there is this one Option: "Scanning always available". Dunno if this is enabled per default and if this could mean the same as those WiFi Optimization with KitKat Roms. As i am not able to reflash til tomorrow i am not able to test this out yet.
Problems seems to be fixed by new Prima WiFi-Drivers which were merged into CM12.1 yesterday.
Update: Reappeared. Seems to be a problem with my router and the WiFi Chipset in general. Haven't this issues on any other router than the one in my hood. Visitors with different phones have no problems with my router.

Wifi connection troubles after update to 6.0

I'm not sure if this is a Nexus 5 problem or a 6.0 Marshmallow problem but the problem occurred after the update to 6.0 on both Nexus 5s for me and my wife.
There seems to be some bug with my phone while it is asleep (screen is off but phone is on). When it is in this mode, it will not stay connected to wifi. For example, when I enter an area that has wifi, my phone will not connect. It will only connect when I wake the phone. And this isn't just a matter of the phone taking a while to connect. It NEVER connects. Before the update, my phone used to make a connection with my home router before I even walked inside. Now, I can be inside for hours and the phone never connects, until I wake it up. As soon as I wake the phone, the phone makes the connection with no problem. After a few minutes of the phone being asleep, I will wake the phone and the wifi connection will be gone. Now that it is awake again, it connects again with no problem.
I have tried forgetting the network and creating a new one, I have tried different routers, I have tried wiping the cache partition. I haven't tried a full factory reset, and I'd prefer not to, but I guess I will if I have to.
Just thought I would check here first and see if anyone had other thoughts.
Settings - wifi - menu - advanced - Second choice down from the top - choose how to keep WiFi depending on your battery charge %. Regards. Alessandro
Alessandro
vn800art said:
Settings - wifi - menu - advanced - Second choice down from the top - choose how to keep WiFi depending on your battery charge %. Regards. Alessandro
Alessandro
Click to expand...
Click to collapse
Thanks for the reply. Yes, that is what I thought at first also. I meant to say in my original post that my wifi settings are set to "Always On" during sleep. I've tried toggling that between the settings but still have the trouble.
Sorry, my Nex 5 has not this issue on Android 6 build MRA58K.
Alessandro
Yup, have the same issue. When the phone goes to sleep, it seems to disconnects from the wifi and never connects after I wake the phone. When I go into the wifi settings, I see "WIFI Connection Failure". I have to reconnect manually. Like the OP, have it set to always on as well. I also know it's not a router issue because I've tried this on four different routers (two linksys, one Dlink, one TPLink) All same results.
Wonder if this is a phone issue?
Please go here and click on the star to vote for this issue.
https://code.google.com/p/android/issues/detail?id=190667
Google upped this to a high priority Friday morning (Nov 6). The bad news is I think there a couple different WiFi symptoms being discussed here. Most of what is being discussed is the issue being discussed here (not reconnecting when the screen is off).
No idea when this will be fixed, so I build a Tasker profile to toggle WiFi every 15 minutes when not already connected to force a reconnect. I’ve observed it getting disconnected on its own overnight. This should avoid unnecessarily using cellular data.
I’m perpetually waiting for the next release of Android to fix annoying bugs.
vn800art said:
Settings - wifi - menu - advanced - Second choice down from the top - choose how to keep WiFi depending on your battery charge %. Regards. Alessandro
Alessandro
Click to expand...
Click to collapse
GaryP2 said:
Please go here and click on the star to vote for this issue.
https://code.google.com/p/android/issues/detail?id=190667
Google upped this to a high priority Friday morning (Nov 6). The bad news is I think there a couple different WiFi symptoms being discussed here. Most of what is being discussed is the issue being discussed here (not reconnecting when the screen is off).
No idea when this will be fixed, so I build a Tasker profile to toggle WiFi every 15 minutes when not already connected to force a reconnect. I’ve observed it getting disconnected on its own overnight. This should avoid unnecessarily using cellular data.
I’m perpetually waiting for the next release of Android to fix annoying bugs.
Click to expand...
Click to collapse
Thanks for the update Gary. The comment #6 describes my situation exactly. In doing some troubleshooting of my own, I find the disconnection trouble to happen less while on a 5Ghz network vs 2.5. I still have the trouble of it not connecting initially when I come into range, but I find that it is able to hold the connection while asleep.
I am also experiencing this on my Nexus 5 and also found and starred the thread above.
I just listened to 20min of streaming with Spotify to then realize that it had gone into Doze and used the mobile data!
This is more than annoying...
Maybe by disabling Doze for some specific connectivity-related system app? Anyone tried that?
Yes, I moved virtually all of the services type of apps (the ones with the green generic Android icon) to the battery not optimized list. It didn't make any difference for me.
In some ways it seems like it might be a Doze problem, and in other ways it doesn't. Doze shouldn't be affecting anything when the phone is in my pocket and I walk in the house to my WiFi. It also shouldn't be affecting anything when the phone is being charged, which is when I see frequent WiFi disconnects.
It will be real disappointing if this isn't fixed with 6.0.1.
This is still an issue with 6.0.1. Nexus 5 (2013) 6.0.1 MMB29K updated through OTA ZIP pushed with ADB.
Things work properly for a while right after a reboot and then WiFi never connects until the screen is turned on.
Google Connectivity Services C.1.6.7 (2466695) update didn’t make a difference either.
Same problem as the thread starter. HTC A9 anroid 6.0. (newest available OS)
Same problem here with a Nexus 5 .
Please star the problem if you have it.
https://code.google.com/p/android/issues/detail?id=170078
Has anyone tested with a non-stock kernel ?
I'm asking because the problem seems +/- resolved on CM13 (non caf).
No counting CM13, do you know of a more stable rom with the problem resolved?
Does anyone here have Wemo devices? I am reading that wemos, and possibly other devices that emit their own wireless network, may cause problems. I have several of these devices around the house, and wonder if that might be contributing. However, that only would solve the dropped connection bug I have, not the failing to connect while asleep but I have.
Hi mates, my Nexus 5 (android 6.0.1,M8974A-2.0.50.2.29) gets the same troubles with wifi connection but today I tried to put some apps in non optimized list of Doze and seems workig fine.
Thats my non optimized Doze list:
-Google Play Services
-System UI
Try it and let me know if it works properly.
frontomix said:
Hi mates, my Nexus 5 (android 6.0.1,M8974A-2.0.50.2.29) gets the same troubles with wifi connection but today I tried to put some apps in non optimized list of Doze and seems workig fine.
Thats my non optimized Doze list:
-Google Play Services
-System UI
Try it and let me know if it works properly.
Click to expand...
Click to collapse
I had Google Play Services already set to not optimize, but hadn't tried System UI. I will try that out and see what happens.
whitenack said:
I had Google Play Services already set to not optimize, but hadn't tried System UI. I will try that out and see what happens.
Click to expand...
Click to collapse
Welp, that didn't work. Still have the error after not optimizing System UI in addition to Google Play Services.
I don't know if the issue is resolved, but at least for me, it never worked fine so many days after testing some new workaround.
So, this was what I did in my Nexus 5 (latest build, MOB30H).
Uninstall or deactivate Google Connectivity Services, reset your network settings (you will lose your Wifi networks and BT pairings), reboot.
My Nexus 5 has been connecting to the wifi networks even with the screen off for the last 6 days.
Miguun said:
I don't know if the issue is resolved, but at least for me, it never worked fine so many days after testing some new workaround.
So, this was what I did in my Nexus 5 (latest build, MOB30H).
Uninstall or deactivate Google Connectivity Services, reset your network settings (you will lose your Wifi networks and BT pairings), reboot.
My Nexus 5 has been connecting to the wifi networks even with the screen off for the last 6 days.
Click to expand...
Click to collapse
Miguun, has the error returned, or still fixed? I just got the May update, so fingers crossed that fixes it. Otherwise, I guess I'll try your fix. I don't look forward to entering the wifi network information again.
Yup, it is still working !!

WiFi idle drain on custom ROMs [SOLVED]

Solution:
This was first fixed by LOS 16 with their stock kernel. The fix is also in Derp 3.0 kernel ("Rebased over CAF Pie kernel (LA.UM.7.2.r1)"), which can be used with custom ROMs like RR and PE. This kernel can not be used with MIUI, but MIUI did not have this problem, so that does not matter.
So it looks like it was changes/fixes to the WiFi driver in CAF that had to be merged into the kernel. Other custom kernels which also include those fixes would very likely also fix the problem.
-----------------------------------------------------------------------
This is the continuation of the discussion from this thread: https://forum.xda-developers.com/redmi-note-5-pro/development/rom-aosip-8-1-t3804473/page85
I have a problem, together with a few other guys (discussed at LOS, RR and AOSiP threads) and that is WiFi idle drain on custom ROMs.
I tried various Oreo ROMs (LOS, AospEx, AOSiP, PE) and various kernels (stock, NoName, Derp) and various firmwares (9.5.6.0, 9.5.11.0, 9.5.17.0, 8.7.5 and even 8.8.16 non-arb) and always have 3%/hour battery drain on WiFi, while I have only 0.5%/hour on LTE.
There was no problem during my 2 weeks on MIUI global stable 9.5.13.0 and 9.5.17.0.
There are apparently 2 settings that can affect WiFi power saving on clients: DTIM and UAPSD. On my Unifi APs, DTIM was at 1 (default) und UAPSD is off. I tried with 3 and on, but it did not change anything.
This is all while the device is in deep sleep.
Until now, I only had the drain at home (5 GHz, only tested once with 2.4 GHz). At work or in a hotel, everything was OK. But all other devices do not have that problem on my home WiFi and neither did this phone running MIUI.
For example, LOS 15.1 with same apps and same WiFi causes no such drain on Note 4/Mido.
After some searching in the MIUI forums, I also found some guys with WiFi idle drain there. But it seems, this started after MIUI 9.5.6.0 for them.
So, I flashed firmware 9.5.6.0 on my PE 8.1 installation. Still 20% drain over night on idle WiFi. So, this firmware does not help either and it's the oldest Oreo firmware I found.
Answering a question from the other thread:
Normally, I am on airplane mode over night, not charging. This causes only 1% drain total. In the morning, I am charging the device. This is generally enough time to get to 100%. I am not charging over night because this is not so good for the battery.
So, I am experiencing the idle drain during the evening at home and during the weekend at home. On LTE at work, everything is fine, even great.
The only thing left that I can do is to go back to LOS and create a bug report in their Jira. They are the only ones to have a proper bug tracker and also I think the LOS maintainers are the same guys that brought treble support to the device in the first place. I will do that probably on Wednesday, with the new LOS version from this week.
i'm on AOSiP now and i think dont have wifi idle drain (ss from BBS attached).
this device almost always in wifi, and it could easily reach 10h of SOT with 2days + usage
for info, my phone in miui China V9.5.16.0.OEICNFA while waiting 360 hours to unlock. and after unlock i just flash it with:
AOSiP + opengapps pico 20180812 + Magisk V16.0 without flashing any firmware / Miui Global rom before.
and im using LEDE 17.01.4 for router (2.4 Ghz band) if that matters
so many users have wifi idle drain (even on AOSP based rom) and this made me a lil bit curious too, maybe i'll try flash Lineage OS / RR tonight and let it idle until morning.
Aosip here, too. No wifi idle drain observed.
I flashed Havoc today to see if I have any on LOS based ROM.
Sometimes the drain linked with Wifi Location Scanning.
On Oreo go to: Settings > Security & Location > Location > Scanning.
Also this will be affected by what kind of apps you have installed as it will influence how many times this mechanism is used.
Try to disable wifi/bluetooth scanning and see if there is a change in the behaviour.
Hope it helps.
You guys can remember me posting some screenshot about my battery drain overnight, it the aosip thread. Well, here is the day 2 result.
Well I think it isn't much for me, I can live with it. But ofcouse 3% per hour like someone said is not acceptable.
Seems like I also experienced this on the latest Pixel Experience 8.1 ROM on stock kernel with Magisk. I have flashed Derp 2.2., still haven't tested yet.
Sent from my Xiaomi Redmi Note 5 using XDA Labs
peter-k said:
Aosip here, too. No wifi idle drain observed.
I flashed Havoc today to see if I have any on LOS based ROM.
Click to expand...
Click to collapse
6 h on Havoc, Wifi on all the time = 0 % Wifi draw.
It certainly has to do with the WiFi router somehow. I have 2 Unifi APs at home, which are being considered as semi-pro. But others have the same problem for example with TP-Link.
I added info about my WiFi to the 1st post.
For me:
Note 4 on Unifi AP, 5 GHz: 3%/hour
Note 4 on Unifi AP, 2.4 GHz: 3%/hour (<- not 100% sure, tested only one time)
Note 4 on Hotel WiFi, 2.4 GHz: 0.2%/hour
Note 4 on Work WiFi, 2.4 GHz: 0.2%/hour
Note 5 on Unifi AP, 5 GHz: 0.2%/hour
Mi Mix on Unifi AP, 5 GHz: 0.7%/hour
I will try switching off WiFi location scanning this evening.
phiexz said:
i'm on AOSiP now and i think dont have wifi idle drain (ss from BBS attached).
this device almost always in wifi, and it could easily reach 10h of SOT with 2days + usage
for info, my phone in miui China V9.5.16.0.OEICNFA while waiting 360 hours to unlock. and after unlock i just flash it with:
AOSiP + opengapps pico 20180812 + Magisk V16.0 without flashing any firmware / Miui Global rom before.
and im using LEDE 17.01.4 for router (2.4 Ghz band) if that matters
so many users have wifi idle drain (even on AOSP based rom) and this made me a lil bit curious too, maybe i'll try flash Lineage OS / RR tonight and let it idle until morning.
Click to expand...
Click to collapse
This is very good. You only lost 15% and you used the phone for more than an hour actively.
biswassumit25 said:
You guys can remember me posting some screenshot about my battery drain overnight, it the aosip thread. Well, here is the day 2 result.
Well I think it isn't much for me, I can live with it. But ofcouse 3% per hour like someone said is not acceptable.
Click to expand...
Click to collapse
Interesting would be the drain on WiFi in deep sleep. But I guess, you do not have the problem.
Wifi deep sleep drain - Troubleshooting and testing
Prologue
I am using Redmi Note 5 whyred global version 4/64 GB. I get it from 9.5.6.0, UBL and root it from the very first day. Update OTA twice via full recovery zip, to 9.5.13.0 and to 9.5.17.0. During all usage of the MIUI ROM usage, I constantly achieve 10+ hours in 1,5 days; usually around 12-14 hours SOT. If I left the wifi on during night, I only lose about 4-5% after awake, which is about 0,6%/hour.
Then ARP hit the deck and I have decided to switch to custom ROM. I picked RR as it is based on LOS and have much more customization. I followed the instruction to flash firmware 8.7.5 before flashing RR 6.1 20180706 + micro gapps 20180705 + Magisk 16.0 again. Since then, i never achieved SOT more than 10 hours anymore. After quick troubleshooting I realize that the idle drain during sleep when wifi is connected is around 2-3%/hour. I wake up in the morning to find my phone has lost 15-20% just overnight doing nothing.
After knowing that it is the wifi, I test the LTE and found out no massive drain, only around 0,6%/hour, which is quite normal (same as in MIUI). I then install BBS and troubleshoot it.
How to know the wifi deep sleep drain?
The easy way to test this is : just setup any wifi router, hotspot from other phone is also OK, no internet needed. Then just leave your phone connected to the wifi, note the percentage and came back again after several hours. The easiest time to spot it at night when we sleep. I have waken up several times to find out 15% drain in 6 hours, or maybe 24% in 8 hours. Approx 3%/hour. While the same setup in LTE, only take away 4-6%.
Why is it bad?
Because at 3%/hour, if we leave the phone doing nothing only connected to wifi for a day, the battery will drop to 52% (consuming 48%) while giving 0 hour SOT. In 2 day, the battery will be dead, no doing anything. While using standard drain, it should be only 0,6%/hour, which is about 15%/day. We can even leave the phone up to almost a week.
The preset condition as the baseline
1. In MIUI 9.5.6.0 - 9.5.17.0 I can connected to wifi/LTE, all get only about 0,6%/hour idle drain.
2. After using RR 20180706 (to 20180724), connected to wifi, dual SIM active, will give idle drain about 2-2,5%/hour (thus I called wifi deep sleep drain).
3. Same RR, switch to LTE, dual SIM active, only 0,6-0,7%/hour
4. No LTE, only dual SIM, about 0,4%/hour
5. Airplane mode (no wireless at all), almost no drain in 5 hours
6. Wifi on, but forget the password (so it won't connected), almost no drain in 1 hour
7. The sensor, either Google play services is there all the time and doesn't give any difference whether in wifi, LTE, or airplane. So sensor wakeup is not the culprit.
8. All wifi signal level are strong (most of the time within 1-2 metres from router). Most of the wifi AP/router are from Tp-link. And before we say it is the wifi AP, i don't experience the drain using the same wifi when in MIUI.
9. You can the comparison of the same battery life and SOT, Wifi vs LTE on the same preset condition ROM RR 6.1 20180723; but the result is very different.
List of troubleshooting done
I am going to post a very thorough but not exhausting list of the testing I have made (and failed to solve the problem)
01. Turn on wifi and connected, phone lose approx 2%/hour (and later approx 3%/hour)
02. Turn off wifi and switch to LTE, phone lose approx 0,6-0,7%/hour, which is normal drain
03. Check with BBS, google play services always wake up the sensor. Sometimes it is the Lineage OS system or phone. But I quickly rule out this as the culprit. As I can see the same wake up when using LTE, but no massive drain. So even same wake up, only wifi connected will give massive drain
04. Airplane mode, phone almost not lose any percent in 5 hours!!! Even though the BBS is reporting the Play services is waking up the phone for 3+ hours. So sensor wake up is no the culprit. (confirmed)
05. Try different wifi, I have two wifi router at home. I also have connected to 2 different wifi router at office. All give the same drain. But when in MIUI, I am connected to the same wifi, but no such drain
06. Set the wifi as metered connection, same drain. Unmetered, same drain
07. Found the possible culprit about wifi logging by cnss_diag. So I tried to disable the logging by editing the /data/misc/wifi/cnss_diag.conf using the tutorial how to disable the wifi logging. The log is not written anymore, but the drain still there. Result : Same
08. Try another solution by Aqq123 to edit the /vendor/etc/init/hw/init.qcom.rc. Commented out those lines. Reboot and confirmed the cnss_diag is not running anymore from ps -A. Result : Still same
09. Try in unmetered wifi 2,4 GHz, same. Try in metered wifi ac 5,0 or n 2,4 Ghz, same.
10. Try to connect to another separate wifi router 2,4 Ghz with no internet connection and only my RN5 as the sole wifi client (so no possible interference or broadcast from other devices), still the same.
11. Disable various RR configuration, such as double tap to sleep/wake, brightness slider, etc; same drain
12. backup the kernel, flash derp kernel 1.8, same. Restore back to stock kernel. I tried again derp kernel 2.2, same.
13. There is gapps update, so I reflash from micro to nano; still same. Currently updated to nano gapps 20180818, same
14. Disable wifi always scanning in the location setting, same. Disable the bluetooth scanning too, same.
15. Disable location feature (completely off), still the same. Deny all apps for the location permission, and worse, drain become 4%/hour
16. Reset wifi, mobile, bluetooth and reconnect again, still same
17. Change the static IP to DHCP, still the same.
18. Turn off Automagic services, since I have some remote server flow enabled when connected to wifi, same drain
19. Boot to safe mode, with only gapps and system app enabled, same drain
20. Disable Wi-Fi calling (derived from VoLTE), same. I enabled it and choose wifi. Then choose mobile. Then turn it off too. All still same drain.
21. I though it might the modification I made to the VoLTE. I undo the modification, set the VoLTE back to nothing, so the VoLTE completely non active (can't call anymore); same drain
22. Try something else not related, disable the network traffic indicator and seconds in the time. Same, no effect.
23. In the logcat, there are same crashes from LOS thermal engine every few seconds. But the same crash happen on LTE, still not drain. Only at wifi connected, so must not be the crash.
24. Set the wifi sleep policy to never. Seems to solve it, but fake solution, only placebo effect. It came back to 3%/hour drain again.
25. at the system setting, i find any value related to wifi, such as wifi_networks_available_notification_on, wifi_wakeup_available, wifi_wakeup_enable and etc; all set to 0, same drain (I have restarted after setting the value)
26. I compare the battery life of the LTE vs wifi in bugreport, throw them at battery historian. I can't find any difference in relation to the drain. (maybe it is too complex for me to read it)
27. I compare the ps -A, using automagic to capture the command output when connecting to wifi; switch to LTE and capture again. Compared both result and show the line difference. All processes are the same, all exist, only in different PID
28. Using the similar flow, I compare the tcp connection. same result, only different PID and port.
29. Uninstalled several app those probably related to wifi, and still the same
30. I think it maybe caused by the firmware. I am using 8.7.5 firmware. So I flashed back to 9.5.17.0, same dari. Flash to non arb 8.8.16, same drain. So I flashed back to 9.5.17.0 firmware.
31. Tried AOSiP ROM 20180808 build. At first hour after flashed the ROM, haven't enter the google account and haven't restore apps; only stock apps and nano gapps. Connect to the wifi and setup several configuration. leave and no drain in 1 hour. But after I login my google account and restore 98 apps; leave it again for another hour, now suddenly the 3%/hour appear. So I can safely said it was cause by some apps in 98 apps or the google account itself.
32. Because it is caused by the apps/account; I tried to disable/freeze some apps to test. I have froze Google search, Google Text to Speech, Playstore, whatsapp, Mi Fit and several others; still same drain.
33. Tried to disable wifi and data access for Google Play services, still same drain
34. Switch to battery extreme power saver mode, still same drain (seriously?)
What is not the possible culprit anymore?
1. The wifi router. Since they are all the same wifi I connected when using MIUI ROM. This rule out them
2. Kernel and firmware, have changed them and give no effect
3. ROM, I changed to AOSiP, same drain. Sidamos77 also have tested several ROM and the drain persist.
4. Location, wifi scanning, sleep policy etc; no effect
5. Sensor wake up or any wakeup in BBS or GSAM, as the same wake up appear in airplane mode but no drain
6. Not the user app, as safe mode rule them out
7. not the wifi logging (cnss_diag), as disabling it also same drain
8. wifi configuration, have changed it still the same drain
9. VoLTE, wifi calling, not related
10. Logcat show nothing to indicate the drain; same crash in wifi and LTE
11. Running services and TCP connection also almost the same
12. Not the system app/gapps such as Google search, Google text to speech, Playstore
Keypoint of possible culprit
1. vendor partition of all AOSP-ish ROM. But why not everyone experienced the drain
2. the gapps, again, why not everyone
3. hardware problem. This might explained it, but why all got the same problem only after switch to custom ROM
4. user apps, very difficult to trace.
5. Google account. Arrgh, this remove out most of the android usability.
Solution I haven't try
1. Factory reset and restore app backup. But I have tested this in AOSiP, so I won't do it again
2. Remove the google account and try. I am afraid to mess up something, so I need preparation and check before trying this
3. Install pico gapps. But I wonder if it will do anything. I need the text to speech anyway.
4. Switch back to MIUI and try the drain again, to prove it doesn't have drain in MIUI. Too hassle, I fell in love with RR and can't stand MIUI again.
Workaround
I have thought a workaround by using Automagic to turn off the wifi after certain amount the screen goes off. I will set the wifi to be on for 1 minute for every 15 minute. But I occassionally download something using wifi. This will break most of my activities, so it is not acceptable. Beside i also transfer data and remote scrcpy to my phone. Screen off will kill the remote server and makes me need to turn it on again manually (why I use Automagic then, if I still need to do it manually?)
Epilogue
Now, my phone is set at TWRP 3.2.2.0, Magisk 16.0, ROM RR 6.1 20180723, nano gapps 20180818, kernel Derp 2.2, firmware 9.5.17.0 + various user apps such as WA, Chrome, Gmail, Maps, MiXplorer, Automagic, GMD gesture, Gcam Arnova v8.2, etc. And I still experience this 3%/hour wifi deep sleep drain. It has been a month and I have spent quite a lot of hours and energy troubleshooting this.
@Desmanto
Thank you very much for putting together this comprehensive analysis!
I can add: Pico GApps is not the solution, I always use those (when I need GApps).
Did you ever have a day with fully installed RR, where it did not drain on your WiFi? Because I had this once or twice. At least one time on AOSiP.
Today I tested the 2.4 GHz WiFi at work. No drain.
On the way home, I disabled WiFi location scanning (as suggested above), although I know that you already tried it. I also uninstalled a few apps that I do not need often. Some of them have been installed with Titanium Backup.
Now at home, I have a drain of only 1% in 3 hours! Also, my WiFi AP software shows that the phone is using WiFi power saving mode for the very first time. I did not even see that for the Note 4, although I suspect you have to leave the phone untouched for a longer time for that to happen. BTW, I have WiFi location scanning ON for all my Android devices usually.
I will later switch WiFi off and on and see what happens over night. Last night, I lost 20%.
No drain on pie btw
FroZine said:
No drain on pie btw
Click to expand...
Click to collapse
Did you have drain on Oreo?
sidamos77 said:
Did you have drain on Oreo?
Click to expand...
Click to collapse
Yeah. On all ROMs I tested. Even on miui
@FroZine: Which Pie version do you have? PixelExperience?
sidamos77 said:
@FroZine: Which Pie version do you have? PixelExperience?
Click to expand...
Click to collapse
Was on latest GSI image with no drain and now I'm on mcaosp. Found here on xda for whyred.
FroZine said:
Was on latest GSI image with no drain and now I'm on mcaosp. Found here on xda for whyred.
Click to expand...
Click to collapse
This ROM does not have its own "official" thread on XDA?
sidamos77 said:
This ROM does not have its own "official" thread on XDA?
Click to expand...
Click to collapse
https://forum.xda-developers.com/redmi-note-5-pro/how-to/rom-mcaosp-rom-t3831395
Installed derp kernel. Sleeps like a baby.

Categories

Resources