WiFi prevent phone from sleeping - OnePlus 3 Questions & Answers

Hi,
(I'm on Ressurrection Remix 5.8.5 / Nougat 7.1.2 final, rooted; installed O+3 OB24 firmware)
Recently (around mid-Feb) I started having problems with battery life on my device. I haven't changed anything (significant, not that I remember) but it was annoying me so on the road to figuring out which app/part of the system could cause the battery drain I ended up with pure Resurrection Remix rom without any Gapps (or any other apps for that matter) and... battery was still draining like crazy (which only annoyed me more). And with helpers like WakeLockDetector it say that my device was in deep sleep less then 50% of the time (and it was mostly laying on the table!)
The other day I noticed that if I disable WiFi all of the sudden device got decent sleep time (about 10-25% of awake time, which was consistent with my use case). I check the settings of wifi and had "keep wifi on during sleep" set to 'always' (however from performance and battery drain perspective having wifi on and even having idle TCP connection open shouldn't drain battery that much). I switched it to 'keep on only while charging' (no effect) and then to 'never' (also no effect).
Then I turned to old friend - 'llama' aplication and configured it to disable wifi the moment I turn off the screen and then when I turn on the screen activate wifi. With that setup I went from having 20-25% by the end of the day (unplug the phone around 6-7am, check around 6-7pm, i.e. after 12h) to still having 70% left with the same usage/timeframe. Generally this could be it, but! This is still kinda semi-automatic and I would loose notification if I don't explicitly wake device.
I was under the impression that this should be handled by doze - i.e. if the phone is lying on the table it would force device into deep sleep and then periodically wake it up to allow apps to refresh it states. In my case it looks like something is preventing doze from working correctly and placing phone into deeps sleep. I wan't as low-level as my (current) knowledge let me and I'm kinda stuck and don't know what to check next or how to fix it.
After using llama to disable wifi while screen is of the wakelock by 'PowerManagerService.WakeLocks' went down significantly as well as awake time.
Battery details: https://www.dropbox.com/s/bvf47nzx7ob5wc8/battery-details.png?dl=0 (wifi always on)
Wifi config: https://www.dropbox.com/s/2v65dugidp57rrd/wifi-config.png?dl=0 (nunca/never)
I would be very thankful for all suggestions.

.wojtek said:
Hi,
(I'm on Ressurrection Remix 5.8.5 / Nougat 7.1.2 final, rooted; installed O+3 OB24 firmware)
Recently (around mid-Feb) I started having problems with battery life on my device. I haven't changed anything (significant, not that I remember) but it was annoying me so on the road to figuring out which app/part of the system could cause the battery drain I ended up with pure Resurrection Remix rom without any Gapps (or any other apps for that matter) and... battery was still draining like crazy (which only annoyed me more). And with helpers like WakeLockDetector it say that my device was in deep sleep less then 50% of the time (and it was mostly laying on the table!)
The other day I noticed that if I disable WiFi all of the sudden device got decent sleep time (about 10-25% of awake time, which was consistent with my use case). I check the settings of wifi and had "keep wifi on during sleep" set to 'always' (however from performance and battery drain perspective having wifi on and even having idle TCP connection open shouldn't drain battery that much). I switched it to 'keep on only while charging' (no effect) and then to 'never' (also no effect).
Then I turned to old friend - 'llama' aplication and configured it to disable wifi the moment I turn off the screen and then when I turn on the screen activate wifi. With that setup I went from having 20-25% by the end of the day (unplug the phone around 6-7am, check around 6-7pm, i.e. after 12h) to still having 70% left with the same usage/timeframe. Generally this could be it, but! This is still kinda semi-automatic and I would loose notification if I don't explicitly wake device.
I was under the impression that this should be handled by doze - i.e. if the phone is lying on the table it would force device into deep sleep and then periodically wake it up to allow apps to refresh it states. In my case it looks like something is preventing doze from working correctly and placing phone into deeps sleep. I wan't as low-level as my (current) knowledge let me and I'm kinda stuck and don't know what to check next or how to fix it.
After using llama to disable wifi while screen is of the wakelock by 'PowerManagerService.WakeLocks' went down significantly as well as awake time.
Battery details: https://www.dropbox.com/s/bvf47nzx7ob5wc8/battery-details.png?dl=0 (wifi always on)
Wifi config: https://www.dropbox.com/s/2v65dugidp57rrd/wifi-config.png?dl=0 (nunca/never)
I would be very thankful for all suggestions.
Click to expand...
Click to collapse
Is wifi/BT scanning on in Location? If so switch it off.
Also check whether the firmware you use is correct or requires updation.

tnsmani said:
Is wifi/BT scanning on in Location? If so switch it off.
Also check whether the firmware you use is correct or requires updation.
Click to expand...
Click to collapse
I have BT off (haven't used it in my life…)
As for wifi scanning - you mean notification about available networks? yes, its' off.
What do you mean about firmware? Could that affect radios? in that case - which firmware should I install with RR 5.8.5? I'm not sure if "the latest" is alwasy the best idea (problems with compatibility)

.wojtek said:
I have BT off (haven't used it in my life…)
As for wifi scanning - you mean notification about available networks? yes, its' off.
What do you mean about firmware? Could that affect radios? in that case - which firmware should I install with RR 5.8.5? I'm not sure if "the latest" is alwasy the best idea (problems with compatibility)
Click to expand...
Click to collapse
Go to Settings>Location then click the three dot menu at top right, then click Scanning and disable wifi and BT scanning.
If that doesn't work, check on the ROM thread which firmware is recommended for your version of the ROM and flash it.

That one is also off.
As for firmware - I have (it seems) latest recommended one.

Related

Here's my workaround for the annoying WiFi battery drain bug on CM10.1

This is no longer needed! The bug is fixed with the new quattrimus and the Wind kernels... and probably an upcoming official one as well. 3-30-13
This is for those of you on CM10.1 (or ROMs based on it) who use wifi and need a way to work around the Wifi battery draining bug. If you didn't know, the wifi bug will cause your device to lose power at at rate of 6-10% per hour while just sitting idle with wifi turned on. This is aggravating for those of us who use wifi a lot and are used to just leaving it on because normally wifi uses LESS power than other connections!
I was formerly using DS Battery Saver or Green Power to toggle my connections, but I like the following method better because it is a bit smarter (you'll see what I mean). Also, sometimes those connection toggler apps would screw up my autosyncing and messages wouldn't show up for hours.
I tried the wifi timeout hack, which kind of sucked because wifi still stayed on in areas with no wifi.
After trying a ton of apps and combinations of apps, I've found a solution that works pretty well. Here it is:
1) Install the app "Better Wifi On/Off" by Sven Knispel
2) Open it up and hit the settings button. Put a check on "Expert Mode", then back out of the settings and go back in.
3) Place check marks next to the following settings options only:
- Enable when user turns wifi on
- Start on boot
- On when screen unlocked
- On when plugged in
- Only if connected
- If wakelock is held
- If network activity
- If plugged in
- Off when unplugged
- Off when screen off
4) Now find the option marked 'Delay - Time to wait before checking Wifi status' and set it to 10s. 0s may also work well, but I haven't tested it.
5) Profit.
*If you have problems with the program stopping, you can go back into Settings and put a check on 'Run as foreground service'.
**The program has a widget you can add to a homescreen so you can quickly disable/enable it if you have to.
With this setup, Wifi simply turns on when I need it and automatically turns off when I don't. It checks for traffic and won't kill the connection until your download or stream is done. It checks for access points, and if there are none available it turns wifi off... something that DSBS and other similar apps don't do all that well.
I'm getting battery life similar to if I had DSBS, Juice Defender or Green Power running- but I never lose autosync and nothing is ever delayed, because mobile data never turns off. I tested my hotspot function and it worked just fine with no interference.
Hope this helps until (if) we ever get a real fix for the wifi drain bug.
I'm not sure if I had something set wrong or it was an interaction with another program or something else, but I tried it and it locked up my phone hard. Not even the buttons light or feedback goes off but no screen. Had to use the hold power to reset.
I hope they're able to get the power issues taken care of in CM10. With the newer nightlies and the wind kernel it's honestly about as stable as CM9 for me. Power usage is my only major issue now.
SeriousGeorge said:
I'm not sure if I had something set wrong or it was an interaction with another program or something else, but I tried it and it locked up my phone hard. Not even the buttons light or feedback goes off but no screen. Had to use the hold power to reset.
I hope they're able to get the power issues taken care of in CM10. With the newer nightlies and the wind kernel it's honestly about as stable as CM9 for me. Power usage is my only major issue now.
Click to expand...
Click to collapse
Yeah it must have been something else at play- the above app doesn't really do anything unusual that would cause a hang. It's been doing well for me today- I've been using my phone pretty steady since 7am and I'm at 40% battery (now almost 4pm). I'm currently on miroslav_mm's CM10.1 build.

Android OS wakelock battery drain - WiFi issue [CM11]

I bought a Tab Pro 8.4 and decided to install Cyanogenmod 11 on it (currently on M12).
When I check my Battery usage under Settings after leaving it alone for several hours, "Android OS" is shown to be using over 60%. I tried using the Wakelock Detector app, and that didn't show any rogue apps. The "total wake time" in WD also closely matches the "keep awake" time for Android OS in Settings>Battery. There's even been a few times that my device didn't go into deep sleep at all.
Restarting the device didn't help as the problem would come back after an hour. I've tried several fixes including turning off auto-sync, using Greenify to freeze apps, and wiping my external SD card. None of them worked, but now I think I've found the source of the problem.
If I turn off wi-fi, "Android OS" no longer shows up at the top of my Battery page. Turn wi-fi back on and the problem comes back. Turning sync off doesn't change anything, so it seems like the issue is with the wi-fi itself and not with syncing apps. I even went into advanced Wi-Fi settings and changed it to 'turn off wi-fi during sleep' and still had the battery drain (though not as much - around 30% but still more than anything else). Changing the "Wi-fi Optimization" setting doesn't do anything either. I do notice sometimes when using my tablet that I don't have as many bars (on the wi-fi symbol in the status bar) as I do on my phone.
Does anyone have experience with this wi-fi issue? My GS3 doesn't do this. I assume that the problem is that my tablet device has a bad wi-fi connection and is always scanning or something, but I have no idea where to go from here.
EDIT: I might try downgrading to a previous milestone of CM11. I was reading in another thread how some other people were having wifi issues on M12 as well. My GS3 has been stuck on M10 because later updates broke stuff, so I'll try M10 on my tablet.

Is there a way to improve standby time?

Is there a way to increase standby time? I have used both euphoria, clean, and the stock rom with elementalx kernel with dt2w, but they dont seem to help.
Some suggestions:
Make sure dt2w is disabled if using a kernel that supports it, it will eat up battery. If you're wanting to maximize standby time, don't use any mods/features that will cause the device's sensors to constantly "listen" while in standby. If you must use these features (or other similar ones like ambient display), understand it will decrease your standby time.
Configure your wi-fi settings to never stay on while sleeping. Similarly, turn off location and bluetooth or use airplane mode when you'll be setting the device down for a bit (or any time you're not actively using them). No need for any of the radios to be on if you're not even using the device.
Don't leave games or apps running in the background when done with the device, kill them all first. Many apps can keep the device awake (either for longer than usual or even indefinitely) if actively running. My wife plays a couple of games on her tablet that are very bad about this.
You can use GSAM battery monitor or any other similar app to see if you are experiencing any wakelocks while the device is sleeping. If so, track them down and adjust your setup accordingly.
Lots of folks also use Greenify, as it can do the job for you of making sure some of the wakelock-happy apps stay hibernating.
Hope some of that helps.
I flashed Marshmallow the day it was released for this and I haven't used it much so it's sat there with Wifi on when screen is on and I think I'm ~50% left after a week? Do you have wifi on? What does betterbatterystats say is keeping the device awake?
Thanks for the advice. Do any other things other than dt2w, ambient display, and ok Google cause the sensors to listen?
I keep the WiFi on and when i use gsam battery monitor, i don't have wake locks.

Terrible battery life probably caused by wakelocks

My battery will completely drain after <10 hours while the screen is off!
However I was able to find out thatquickgooglesearchbar is always the top app.
Those screenshots are a bit old but it's still the same thing, I did manage to root it today, and I was testing Greenify which did nothing even with the Xposed modules, service disabler apps just did not show that specific service for some reason. I was able to remove the widget with Xposed GEL settings but it was still running even though the widget wasn't there.
So can someone please help me out here, maybe the search bar isn't the problem but I just want some battery life.
h ttp://imgur.com/a/gdXKW
(I still can't post links sorry If this is against your forum rules but this is urgent)
Eidoss said:
My battery will completely drain after <10 hours while the screen is off!
However I was able to find out thatquickgooglesearchbar is always the top app.
Those screenshots are a bit old but it's still the same thing, I did manage to root it today, and I was testing Greenify which did nothing even with the Xposed modules, service disabler apps just did not show that specific service for some reason. I was able to remove the widget with Xposed GEL settings but it was still running even though the widget wasn't there.
So can someone please help me out here, maybe the search bar isn't the problem but I just want some battery life.
h ttp://imgur.com/a/gdXKW
(I still can't post links sorry If this is against your forum rules but this is urgent)
Click to expand...
Click to collapse
search and install betterbatterystats (read the whole first post) and it will tell you if its wakelocks etc.
Service disabler apps will need a setting to show system apps (or something similar) ticked or switched to etc.
greenify system apps in greenify also needs to be selected. You may also need to cut wake up paths to get it to stay greenified.
You could alternatively delete the apk of hibernate it (byfar the easiest option of all this).
Darke5tShad0w said:
search and install betterbatterystats (read the whole first post) and it will tell you if its wakelocks etc.
Service disabler apps will need a setting to show system apps (or something similar) ticked or switched to etc.
greenify system apps in greenify also needs to be selected. You may also need to cut wake up paths to get it to stay greenified.
You could alternatively delete the apk of hibernate it (byfar the easiest option of all this).
Click to expand...
Click to collapse
I don't need betterbatterystats, I have battery Battery Historian, check the screenshots, It's clearly the search bar, on my other phone It isn't shown as a top app.
Also I went in the system folder /apps and there was no googlesearchbar, or in any other system apk remover tool, perhaps it was removed by another app, but it's still for some reason running.
Eidoss said:
I don't need betterbatterystats, I have battery Battery Historian, check the screenshots, It's clearly the search bar, on my other phone It isn't shown as a top app.
Also I went in the system folder /apps and there was no googlesearchbar, or in any other system apk remover tool, perhaps it was removed by another app, but it's still for some reason running.
Click to expand...
Click to collapse
Your 3rd image shows googlequicksearchbox had 370ms (milliseconds) of wakelocks over a 9hr period. I really doubt that is your issue.
If it is your top app, then it is probably because of Google Now launcher listening for OK Google spoken keyword.
I seriously doubt that is your battery drain problem as almost 90% of people probably have OK Google turned on and are using Google Now launcher and only a very few have serious battery drain.
BTW wakelocks aren't the issue usually. In the past it has been "partial wakelocks" which means an app locked the device from sleeping, but never released the lock, so the device never goes to full sleep. If you see some app with partial wakelocks or if you see some app with hours of regular wakelocks then that might be an issue. Minutes or microseconds of wakelocks are inconsequential.
I suggest you flash factory image and install your battery tester only. Turn off wifi, bluetooth, nfc, cell radio. Test the drain overnight. That is a baseline for the minimum drain your device can have. Then enable what wireless stuff you normally have turned on. See what that drain is. Then start installing apps and see what that drain is.
If you have reasonable/expected battery drain with stock and everything turned off, then it is just a process of elimination to see what is causing your battery drain.
If you can't get reasonable/expected battery drain with stock and everything turned off, then you probably have a bad battery.
For the record, my overnight battery drain with everything turned off is 0-1% With wifi turned on about 1-2%. With wifi+cell about 2-3%.
IMO the biggest drains for standby are wifi and/or cell signal related. Either bad signals or apps sending data in background or apps that are polling all the time.
sfhub said:
Your 3rd image shows googlequicksearchbox had 370ms (milliseconds) of wakelocks over a 9hr period. I really doubt that is your issue.
If it is your top app, then it is probably because of Google Now launcher listening for OK Google spoken keyword.
I seriously doubt that is your battery drain problem as almost 90% of people probably have OK Google turned on and are using Google Now launcher and only a very few have serious battery drain.
BTW wakelocks aren't the issue usually. In the past it has been "partial wakelocks" which means an app locked the device from sleeping, but never released the lock, so the device never goes to full sleep. If you see some app with partial wakelocks or if you see some app with hours of regular wakelocks then that might be an issue. Minutes or microseconds of wakelocks are inconsequential.
I suggest you flash factory image and install your battery tester only. Turn off wifi, bluetooth, nfc, cell radio. Test the drain overnight. That is a baseline for the minimum drain your device can have. Then enable what wireless stuff you normally have turned on. See what that drain is. Then start installing apps and see what that drain is.
If you have reasonable/expected battery drain with stock and everything turned off, then it is just a process of elimination to see what is causing your battery drain.
If you can't get reasonable/expected battery drain with stock and everything turned off, then you probably have a bad battery.
For the record, my overnight battery drain with everything turned off is 0-1% With wifi turned on about 1-2%. With wifi+cell about 2-3%.
IMO the biggest drains for standby are wifi and/or cell signal related. Either bad signals or apps sending data in background or apps that are polling all the time.
Click to expand...
Click to collapse
Factory reset didn't do anything a few days ago, the results were exactly the same that was when my phone wasn't rooted, so I guess I should return the phone, and get a new one?
Eidoss said:
Factory reset didn't do anything a few days ago, the results were exactly the same that was when my phone wasn't rooted, so I guess I should return the phone, and get a new one?
Click to expand...
Click to collapse
What is your battery drain per hour with nothing installed and all wireless turned off and everything stock?
I'd only return it if that is significantly more than 0-.2% or 1% every 5 hours.
Otherwise it is something you have installed or something to do with the signal and how it interacts with your phone.
Once you start installing stuff or turning on wireless (wifi/bt/cell) then it is no longer purely about the battery and there are more factors that need to be isolated independently.
You really need to establish a baseline to see what the minimum battery drain is. Then you can determine if the battery is the problem or something else.
If you just install everything and turn everything on, there are too many moving parts.
sfhub said:
What is your battery drain per hour with nothing installed and all wireless turned off and everything stock?
I'd only return it if that is significantly more than 0-.2% or 1% every 5 hours.
Otherwise it is something you have installed or something to do with the signal and how it interacts with your phone.
Once you start installing stuff or turning on wireless (wifi/bt/cell) then it is no longer purely about the battery and there are more factors that need to be isolated independently.
You really need to establish a baseline to see what the minimum battery drain is. Then you can determine if the battery is the problem or something else.
If you just install everything and turn everything on, there are too many moving parts.
Click to expand...
Click to collapse
Okay, I now have android N, and my battery life seems to be better, I will leave mobile data off. I will see tomorrow if my battery life has changed.
Do you think I should use Adaptive brightness for more battery life?
Eidoss said:
Okay, I now have android N, and my battery life seems to be better, I will leave mobile data off. I will see tomorrow if my battery life has changed.
Do you think I should use Adaptive brightness for more battery life?
Click to expand...
Click to collapse
Which battery life was the one you think you have a problem with, standby or in use? IMO for in use battery time this phone is about average. Your title of "wakelock" made it seem like you were concerned about standby battery time as it doesn't matter if there is a wakelock if the device is already turned on and in active use.
When turned on, the screen is probably the number one thing eating power, so adaptive brightness could help, but if you are in a bright area, it might be worse than if you fixed the brightness below max.
Even if you have adaptive brightness turned on, the slider scale still is useful as you give the adaptive brigthness mechanism some idea what level of brightness you feel comfortable when the mechanism detects dark, med, bright situations.
One of the worse things for eating power is for the cell radio to be turned on but have no signal, like inside office building or just a bad signal area in general. The reason is the cell radio is power efficient once it establishes signal, but when it is searching for (or loses) signal it uses a lot of power.
If you are doing a lot of disk activity like taking video or hdr pictures, it would probably help to have your userdata unencrypted as this device does software (kernel) encryption and doesn't use the fast/more power efficient co-processor.
sfhub said:
Which battery life was the one you think you have a problem with, standby or in use? IMO for in use battery time this phone is about average. Your title of "wakelock" made it seem like you were concerned about standby battery time as it doesn't matter if there is a wakelock if the device is already turned on and in active use.
When turned on, the screen is probably the number one thing eating power, so adaptive brightness could help, but if you are in a bright area, it might be worse than if you fixed the brightness below max.
Even if you have adaptive brightness turned on, the slider scale still is useful as you give the adaptive brigthness mechanism some idea what level of brightness you feel comfortable when the mechanism detects dark, med, bright situations.
One of the worse things for eating power is for the cell radio to be turned on but have no signal, like inside office building or just a bad signal area in general. The reason is the cell radio is power efficient once it establishes signal, but when it is searching for (or loses) signal it uses a lot of power.
If you are doing a lot of disk activity like taking video or hdr pictures, it would probably help to have your userdata unencrypted as this device does software (kernel) encryption and doesn't use the fast/more power efficient co-processor.
Click to expand...
Click to collapse
Standby is the problem, on screen times are good enough.
Anyway, I don't even know what to do at this point. Android N didn't help enough (cell data is off), I guess I can flash Android 6.0 again and then try to fix it using apps...
What do you suggest I should do, I'm out of ideas at this point.
Eidoss said:
Standby is the problem, on screen times are good enough.
Anyway, I don't even know what to do at this point. Android N didn't help enough (cell data is off), I guess I can flash Android 6.0 again and then try to fix it using apps...
What do you suggest I should do, I'm out of ideas at this point.
Click to expand...
Click to collapse
What is the power drain over a couple of hours with *no apps installed* completely stock, and wifi/cell turned off? What is the change when wifi is turned on?
Eidoss said:
What do you suggest I should do, I'm out of ideas at this point.
Click to expand...
Click to collapse
Have you set "WiFi on during sleep" to "Never"? in the Advanced WiFi settings?
In the original release, there was a bug where WiFi would stay on even if you had set it to "Never" draining battery in standby.
Somewhere between MDA89E and MHC19Q they fixed it and WiFi will go to deep sleep after being in standby for a while, but they introduced another (or exposed existing) bug where WiFi will not resume after coming out of sleep, unless you cycle WiFi off/on. So you're standby battery should be better with this setting, but it'll be a little more annoying when turning on your device.

Battery drain Oreo

I'm on Atomic and from the beginning I've got a problem with battery drain. This night I charged phone to 100% and during the night I plugged out the charger. NFC / WIFI / DATA / GPS OFF. After 1,5h from 100% battery drain to 93% !
https://imgur.com/a/kN5IO
From what I see WIFI running whole the time (even it was off) + phone is not going to deep sleep whole time but stays 518,4Mhz for long time
Any ideas what to do ?
I found that one of miui apps captures tcp dump. If you look under the /MIUI/debug_log/common you will find 2 PCAP files called tcpdump.pcap0 and tcpdump.pcap1
I think that miui findphone application creates it, because i have set disabled "find my phone" and cleared data of these app and files did not appear again
I'm not on MIUI.
So... you can have enabled "always scan" option in wifi setting.
https://www.reddit.com/r/GooglePixel/comments/5t93e4/turned_off_wifi_and_bluetooth_scanning_battery/
Ok I have disabled this option.
Lets see after some time, but I feel like something is keeping my phone awake and it is not getting to deep sleep all the time..
There is a module for magisk that force Doze.
SkubiDoo said:
Ok I have disabled this option.
Lets see after some time, but I feel like something is keeping my phone awake and it is not getting to deep sleep all the time..
Click to expand...
Click to collapse
Try turning off nfc.
I have installed crDroid and looks like drain gone. Just NFC has to be off.

Categories

Resources