Wi-Fi router tweaking - Samsung Galaxy S8 Guides, News, & Discussion

Everytime I get a new phone I install BBS and enable root features but I'd like to wait with the s8 before rooting. That's why I installed BBS and used adb comments to have root features without root. The reason for this is mainly checking for kernel and partial wakelocks and see what I can and can't control. A lot of people will have high battery drain on Wi-Fi without knowing it as it will be under Android system stats. After you install BBS CHECK if you have rx_wlan_wakelock. This one is caused by the router sending beacons to your phone constantly and preventing it from sleeping. There are 3 settings to change to avoid this.:
DTIM interval: set it as high as possible
BEACON interval: set it as high as possible
Fixed IP: assign your phone a fixed IP so the router doesn't send new IP to the phone frequently.

Or... create a virtual wifi ID and have your phone just connect to that with your settings.
Being that we are on XDA. Ill assume you know DD-wrt, Openwrt, etc.. which case changing the settings there on the router could help.
Rather have those tweaked for best speed for my pc anyways vs my phone thus the virtual wifi ssid config.

Related

wifi sleep policy improvement

Hi all
Thinking about the Wifi Sleep Policy settings:
I could not find the exact details of what the different options mean, but with a little common sense:
a) When screen turns off :
- if you have a wifi connection established : When the screen times out, it will turn off wifi and swith to mobile data.
- if you do not have a wifi connection established : The phone is constantly scanning for known wifi networks. When the screen times out, it will turn off wifi and stop all scanning.
b) Never :
- if you have a wifi connection established : when the screen times out the phone will keep that connection.
- if you do not have a wifi connection established : The phone is scanning. When the screen times out, it will keep wifi ON and continue to scan permanently for known networks.
c) Never when plugged in: it is not very clear, but would say its b) if the phone is charging, and a) if the phone is not charging.
Thinking a bit about this, it appears to me that none of this options is the ideal situation.
I would say that the ideal situation is that if I have a wifi connection established, then keep wifi on and the connection for as long as the network is there.
But if I do not have a connection established, I would like the phone to turn off the wifi interface, and turn off all scanning so as not to drain the battery while I am on the streets away from home. Then only begin scanning when I turn the screen back on, and if it no wifi network to connect, then turn off wifi again when the screen times out.
In other words, I think the best situation is a mix of behaviours of a) when there is no wifi connection established, and b) if there is a wifi connection established.
Does this make sense ? or am I crazy? I'd like your opinions please.
Anybody thought about this before? Is there any app or mod that will implement this behavior ?
Thanks
Gonzalo
gbalerdi said:
Hi all
Thinking about the Wifi Sleep Policy settings:
I could not find the exact details of what the different options mean, but with a little common sense:
a) When screen turns off :
- if you have a wifi connection established : When the screen times out, it will turn off wifi and swith to mobile data.
- if you do not have a wifi connection established : The phone is constantly scanning for known wifi networks. When the screen times out, it will turn off wifi and stop all scanning.
b) Never :
- if you have a wifi connection established : when the screen times out the phone will keep that connection.
- if you do not have a wifi connection established : The phone is scanning. When the screen times out, it will keep wifi ON and continue to scan permanently for known networks.
c) Never when plugged in: it is not very clear, but would say its b) if the phone is charging, and a) if the phone is not charging.
Thinking a bit about this, it appears to me that none of this options is the ideal situation.
I would say that the ideal situation is that if I have a wifi connection established, then keep wifi on and the connection for as long as the network is there.
But if I do not have a connection established, I would like the phone to turn off the wifi interface, and turn off all scanning so as not to drain the battery while I am on the streets away from home. Then only begin scanning when I turn the screen back on, and if it no wifi network to connect, then turn off wifi again when the screen times out.
In other words, I think the best situation is a mix of behaviours of a) when there is no wifi connection established, and b) if there is a wifi connection established.
Does this make sense ? or am I crazy? I'd like your opinions please.
Anybody thought about this before? Is there any app or mod that will implement this behavior ?
Thanks
Gonzalo
Click to expand...
Click to collapse
Sleep Policy is pretty simple:
Never means the wifi radio is never turned off. This is default now on Honeycomb and up, with fairly good reason.
When screen is off means.. the radio is turned off when the screen goes off regardless of whether you have a connection.
Only when plugged in means that the wifi radio is only turned off when the screen is off and it's not plugged in.
Sounds like you want Tasker http://tasker.dinglisch.net/
It will let you do what you describe.
Juice Defender will, as well, but it's terrible terrible software.
As to your problem, on most devices, scanning is usually reduced quite a bit when the screen is off. It's not as much of a battery drain as people think.
I'm in the habit of disabling wifi when I'm not at home or in the office. There's really no reason to leave it on when you're not going to be using it unless you want open network notification.
Thank you , I didn't know that the default is now Never. I'll set it this way.
And I guess I don't really have a real life problem, it's just that it got me thinking and came to the conclusions above.
And thanks for the link to the app, I will check it out.
Gonza
edit: oh I see you are the wifi fixer dev. Thanks so much for both replies.
Is your phone rooted? Do you have root explorer and sqlite installed. Then you can have more control over the time wifi goes to sleep after screen is turned off.
BUT: it remains on for 15 minutes by default.
Now start root explorer. Navigate to
/data/data/com.android.providers.settings/databases and open settings.db
If you have sqlite installed you seesome tables. Open secure table.
Add New record. name is wifi_idle_ms and give it a value in milliseconds you want.
Default (if wifi_idle_ms is not present) is 15*60*1000 ms. I have 60000 (1 minute)
Cheers
I use juice defender. Why is it such a terrible software? I've not used others, so I have no means of comparison. Perhaps you can enlighten me?
ZanshinG1 said:
Sleep Policy is pretty simple:
Never means the wifi radio is never turned off. This is default now on Honeycomb and up, with fairly good reason.
When screen is off means.. the radio is turned off when the screen goes off regardless of whether you have a connection.
Only when plugged in means that the wifi radio is only turned off when the screen is off and it's not plugged in.
Sounds like you want Tasker http://tasker.dinglisch.net/
It will let you do what you describe.
Juice Defender will, as well, but it's terrible terrible software.
As to your problem, on most devices, scanning is usually reduced quite a bit when the screen is off. It's not as much of a battery drain as people think.
I'm in the habit of disabling wifi when I'm not at home or in the office. There's really no reason to leave it on when you're not going to be using it unless you want open network notification.
Click to expand...
Click to collapse
androidapk.net said:
I use juice defender. Why is it such a terrible software? I've not used others, so I have no means of comparison. Perhaps you can enlighten me?
Click to expand...
Click to collapse
I'd like to hear that opinion too
JD is not terrible terrible. It is terrific terrific. Honest, it really work flawlessy and it does pretty well what the OP wants. Just for the sake of it, I'm trying to replicate with tasker what JD does, but, you know... it just does it better.
tweakradje said:
Is your phone rooted? Do you have root explorer and sqlite installed. Then you can have more control over the time wifi goes to sleep after screen is turned off.
BUT: it remains on for 15 minutes by default.
Now start root explorer. Navigate to
/data/data/com.android.providers.settings/databases and open settings.db
If you have sqlite installed you seesome tables. Open secure table.
Add New record. name is wifi_idle_ms and give it a value in milliseconds you want.
Default (if wifi_idle_ms is not present) is 15*60*1000 ms. I have 60000 (1 minute)
Cheers
Click to expand...
Click to collapse
Thank you! Yes I am rooted, I am running CM7 latest kang, but I did not know all this.
Gonna give it a try
Interesting. It works indeed! If one knows a bit about Unix shell, I did the modification via adb shell. Obviously the phone must be rooted and have sqlite3 (the binary) installed.
This is how to do it:
- connect the phone via USB to the PC
- execute "adb shell" (adb must be installed) from the DOS prompt. You are into the phone
Then execute the following steps:
Code:
su
cd /data/data/com.android.providers.settings/databases
cp settings.db settings.db.ORIG
sqlite3 settings.db
Now you are "inside" the db. Type ("sqlite>" is just the prompt):
Code:
sqlite> select * from secure;
and check if wifi_idle_ms is not present. If it isn't, as it shouldn't, type:
Code:
sqlite> insert into secure values(60,'wifi_idle_ms',30000);
where instead of 60 you can write any number that is not used already in the list, being that the unique key in the table.
I used 30000 (30000 microseconds = 30 ms) but one can put the value s/he prefers.
Miche1asso said:
Interesting. It works indeed! If one knows a bit about Unix shell, I did the modification via adb shell. Obviously the phone must be rooted and have sqlite3 (the binary) installed.
This is how to do it:
- connect the phone via USB to the PC
- execute "adb shell" (adb must be installed) from the DOS prompt. You are into the phone
Then execute the following steps:
Code:
su
cd /data/data/com.android.providers.settings/databases
cp settings.db settings.db.ORIG
sqlite3 settings.db
Now you are "inside" the db. Type ("sqlite>" is just the prompt):
Code:
sqlite> select * from secure;
and check if wifi_idle_ms is not present. If it isn't, as it shouldn't, type:
Code:
sqlite> insert into secure values(60,'wifi_idle_ms',30000);
where instead of 60 you can write any number that is not used already in the list, being that the unique key in the table.
I used 30000 (30000 microseconds = 30 ms) but one can put the value s/he prefers.
Click to expand...
Click to collapse
Thanks to Miche1asso for the commands, you've made my day :good::fingers-crossed:
This thread is good, useful, it did help up reduce the default wifi idle timeout :good: Just tested on xperia sola, perfect on my custom idea idle timeout (to 120000ms)

Find the causes and the final solution to delayed push notifications in Android

The problem is most known for years: in every web forum you can read about people who have late push notifications with their Android devices and someone else who doesn’t understand why his device works perfectly and suggests to set to set Wifi sleep policy to never :silly: :silly:
During a mobile data connection: two identical devices just out of the box, the first with service provider “X” and the second with service provider “Y”. So, the first with X has notifications perfectly on time, while the second with “Y” has push always late during the sleep mode and notifications appear on the first heartbeat of the gtalk service after several minutes!
During a Wi-Fi connection: same devices but two different routers, a “good” router the first and a “bad” router the second. The same situation.
What I’ve tried: CHANGE DNS! Super simple and super solver! I set the google DNS 8.8.8.8 and 8.8.4.4
How to change DNS?
In wi-fi is easy, in settings!
In mobile data I found only a solution that requires a rooted phone, so it's not for everyone! My provider (3 Italia) set a defalut DNS that can not be changed without root privileges, You can find an app in playstore that can do this.
Results: with MY android NO more heartbeat timeouts!! There are still some disconnections but are not due to heartbeat timeouts.
My conclusion: it is not an Android’s problem but a provider problem!
Please try and report feedbacks in this thread
How do you mean? For 2G/3G networks, do we just install set DNS and change it to 8.8.8.8 and 8.8.4.4?
BTW, I tried the little trick with "tasker", that works pretty well.
Updates after some days of test: changing DNS partially improve the performance of push in Wi-Fi, but not much in 3G!
Now I'm using the app "Tasker": set a short reset of mobile data connection every 5/8 minutes depending on your provider, only in case of DISPLAY STATE OFF (during sleep mode). This task restores every push connection, with small drain of battery ( 5-7% in a day) and without a rooted phone.
_________________________________
Inviato con Tapatalk
I had problem with WiFi, hopefully this DNS trick works I could not change DNS2.. that remains 4.4.4.4
on 3G/H.. my WhatsApp always works

Getting rid of wlan_rx_wake wakelocks

Hey guys,
have you noticed that your device uses up a lot more battery on certain wifi networks (e.g. at work or university)? It is probably caused by the wlan_rx_wake wakelock.
From the wakelocks database:
Rationale: Wifi chip received a packet from somewhere - On a Galaxy S II, lots of these combined with the fact that the device takes 650 msec to resume from suspend and 150 to go back to sleep means that occasional wifi packets coming in will skyrocket Android OS usage. As an extreme example, run the following from a Linux box when wifi sleep policy is "never" and watch your deep sleep percentages plummet, your battery drain, and Android OS skyrocket: ping -i 5 <wifi IP address of phone>
Know actions: Use a sniffer to determine the cause of the traffic.
Click to expand...
Click to collapse
So apparently some other device in the network keeps waking up the Nexus. If the problem occurs in your home network you can easily find out which device is causing the problem by using Shark and Wireshark. You'll get a log that shows every network activity.
Here are some tips from a similiar thread at the SGSII-forums (thanks!):
use a static IP instead of DHCP (you may have to set a static IP every time you sign up in that particular network)
disable IPv6 protocol on your phone - see below
update your router firmware
buy a gaming adapter for your Wifi network that gets the DHCP IP adress, but gives your phone a static IP
optimise router settings: click
Windows network is causing the problem - solution here: click
Change wireless network encryption method, change wifi channel, instead of using auto baseband use only 2.4 or 5GHz baseband (Wi - Fi - advanced - Wi - Fi frequency band)
turn off uPNP in router/AP
t urn off netbios in windows network ("Go to Network and Sharing Center then change adapter settings. Right click on your wireless and select Properties.
Click on the ipv4 and then the properties button. Select Advanced, go to the Wins tab and disable tcp over netbios.")
Thoravukk FAQ tells you: Q. My device not entering deep sleep if i use Wifi?
A: That's not a Kernel issue! It's a Router and (Windows 7) Network problem. Disable IPv6, IP Helper service, shell hardware detection service and the Windows Media Player Network Sharing Service. Source: here
Other apps and devices that can cause the wakelock:
TP Link routers: disable the print server in USB settings
Asus routers: disable AiCloud
disable Dropbox Lan Sync
disable wireless on (HP) printers
disable Canon network scan utility.
Using another kernel might also help to solve this problem: but I haven't tried that yet.
Try out the Franco kernel: http://forum.xda-developers.com/showthread.php?t=2508284
He has merged some wifi driver patches which should adress this problem. It reduced the wakelocks for me to 1 min in over 8 hours on my home network and to 3 min in one hour ony my university network!
So it should be possible to get rid of this problem in your home network.
But what about work or university networks? There are even more devices connected so the problem gets even worse. In Europe we have the Eduroam wifi network at many universities. If I'm connected to this network I get about 20 min wakeup time in one hour. There are a lot of ARP, DHCP and IPv6 request from different sources. Unfortunately you can't change anything about the configuration on your university/school/work network, so we need to find a solution to block these requests on our phone.
A solution for the IPv6 requests might be to disable IPv6 on your phone if you don't use it. In terminal:
Code:
echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
Change the 1 to a 0 if you want to reactivate IPv6. Android resets this setting every time you connect to a network, so you might try Tasker to do this.
I still haven't found a solution for the ARP and DHCP requests though. Any help or input would be appreciated.
Thanks
edit (05/14/14): updated OP with other tips you mentioned
Thanks, this was a useful post. When I am at work on their wifi my phone doesn't go to sleep and definitely drains the battery quickly. Hopefully a better solution can be found.
laxor said:
Hey guys,
have you noticed that your device uses up a lot more battery on certain wifi networks (e.g. at work or university)? It is probably caused by the wlan_rx_wake wakelock.
From the wakelocks database:
So apparently some other device in the network keeps waking up the Nexus. If the problem occurs in your home network you can easily find out which device is causing the problem by using Shark and Wireshark. You'll get a log that shows every network activity.
Here are some tips from a similiar thread at the URL="http://forum.xda-developers.com/showthread.php?t=2133176"] SGSII-forums[/URL] (thanks!):
use a static IP instead of DHCP (you may have to set a static IP every time you sign up in that particular network)
disable IPv6 protocol on your phone (Dorimanx kernels have an option for this in ST tweaks or you can use "Android Firewall" for this
update your router firmware
buy a gaming adapter for your Wifi network that gets the DHCP IP adress, but gives your phone a static IP
optimise router settings: click
Windows network is causing the problem - solution here: click
Change wireless network encryption method, change wifi channel, instead of using auto baseband use only 2.4 or 5GHz baseband (Wi - Fi - advanced - Wi - Fi frequency band)
turn off uPNP in router/AP
t urn off netbios in windows network
Thoravukk FAQ tells you: Q. My device not entering deep sleep if i use Wifi?
A: That's not a Kernel issue! It's a Router and (Windows 7) Network problem. Disable IPv6, IP Helper service, shell hardware detection service and the Windows Media Player Network Sharing Service. Source: here
Other apps and devices that can cause the wakelock:
Dropbox Lan Sync, (HP) Wireless printer, Canon network scan utility.
Using another kernel might also help to solve this problem, but I haven't tried that yet.
So it should be possible to get rid of this problem in your home network.
But what about work or university networks? There are even more devices connected so the problem gets even worse. In Europe we have the Eduroam wifi network at many universities. If I'm connected to this network I get about 20 min wakeup time in one hour. There are a lot of ARP, DHCP and IPv6 request from different sources. Unfortunately you can't change anything about the configuration on your university/school/work network, so we need to find a solution to block these requests on our phone.
A solution for the IPv6 requests might be to disable IPv6 on your phone if you don't use it. In terminal:
Code:
echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
Change the 1 to a 0 if you want to reactivate IPv6. Android resets this setting every time you connect to a network, so you might try Tasker to do this.
I still haven't found a solution for the ARP and DHCP requests though. Any help or input would be appreciated.
Thanks
___
Use the new BBS beta to check your wakelocks.
Click to expand...
Click to collapse
Been having this wakelock as well. Almost all of the packets being picked up by my phone are being sent by my router to random ports. No idea what is really causing it, but it is pretty annoying. Doesnt seem to drain much battery from the device though.
695886915
Apparently this is a known problem. Franco has already merged two fixes from Google in his kernel which reduce the wakelock, but still don't eliminate it completely. But I'm sure that this issue will soon be resolved with custom kernels or even an update from Google.
I'm hoping for this to be fixed too. My N4 didn't exhibit this wakelock, and my N5 is not deep sleeping at all when I'm at work as a result. I'm just using LTE at work, which is okay, but still not the best solution.
Franco Kernel didn´t help at all, since he seem to include all the google wifi patches as well, the official Google update is unlikely to solve the problem... so pissed off by this, eating up my battery so quickly I have to switch off wifi completely (and I hardly have cell data reception here at my workplace) ... sucks!
Thanks finally contained this problem.
Thanks for a great summary of causes and the info I needed to finally contain it. This problem had been dogging me since I got the N5 on my home network.
I tried static IP, no good.
I tried wifi-off on sleep, no good (never got to sleep i guess!!).
I tried forcing 5 GHz, no good.
Finally I followed the advice to Disable IPv6, IP Helper service, shell hardware detection service and the Windows Media Player Network Sharing Service on each Windows PC, and my stay awake time from Android OS plummeted from hours to minutes which I can deal with.
May not work for everyone, but seems to have done it for me. Thanks again.
Thank you for the post. It makes me nervous that I'm getting this wake lock. I previously got it on my GNex and Nexus7 (2012). I tried every method above to fix but got nowhere. For whatever reason my Nexus 4 didn't suffer from this. Hopefully I can figure something out for my new nexus 5
The update to 4.4.1 does not fix this issue. Still getting this wakelock.
Yes. I found the android OS is still killing the battery after updating to 4.4.1
muyoso said:
The update to 4.4.1 does not fix this issue. Still getting this wakelock.
Click to expand...
Click to collapse
Sunkins said:
Yes. I found the android OS is still killing the battery after updating to 4.4.1
Click to expand...
Click to collapse
Wish this would get fixed, as it's my last remaining wakelock issue and the only thing holding me back from getting fantastic battery life.
Sent from my Nexus 5 using xda app-developers app
laxor said:
Hey guys,
have you noticed that your device uses up a lot more battery on certain wifi networks (e.g. at work or university)? It is probably caused by the wlan_rx_wake wakelock.
From the wakelocks database:
So apparently some other device in the network keeps waking up the Nexus. If the problem occurs in your home network you can easily find out which device is causing the problem by using Shark and Wireshark. You'll get a log that shows every network activity.
Here are some tips from a similiar thread at the SGSII-forums (thanks!):
use a static IP instead of DHCP (you may have to set a static IP every time you sign up in that particular network)
disable IPv6 protocol on your phone - see below
update your router firmware
buy a gaming adapter for your Wifi network that gets the DHCP IP adress, but gives your phone a static IP
optimise router settings: click
Windows network is causing the problem - solution here: click
Change wireless network encryption method, change wifi channel, instead of using auto baseband use only 2.4 or 5GHz baseband (Wi - Fi - advanced - Wi - Fi frequency band)
turn off uPNP in router/AP
t urn off netbios in windows network
Thoravukk FAQ tells you: Q. My device not entering deep sleep if i use Wifi?
A: That's not a Kernel issue! It's a Router and (Windows 7) Network problem. Disable IPv6, IP Helper service, shell hardware detection service and the Windows Media Player Network Sharing Service. Source: here
Other apps and devices that can cause the wakelock:
Dropbox Lan Sync, (HP) Wireless printer, Canon network scan utility.
Using another kernel might also help to solve this problem: but I haven't tried that yet.
Try out the Franco kernel: http://forum.xda-developers.com/showthread.php?t=2508284
He has merged some wifi driver patches which should adress this problem. It reduced the wakelocks for me to 1 min in over 8 hours on my home network and to 3 min in one hour ony my university network!
So it should be possible to get rid of this problem in your home network.
But what about work or university networks? There are even more devices connected so the problem gets even worse. In Europe we have the Eduroam wifi network at many universities. If I'm connected to this network I get about 20 min wakeup time in one hour. There are a lot of ARP, DHCP and IPv6 request from different sources. Unfortunately you can't change anything about the configuration on your university/school/work network, so we need to find a solution to block these requests on our phone.
A solution for the IPv6 requests might be to disable IPv6 on your phone if you don't use it. In terminal:
Code:
echo 1 > /proc/sys/net/ipv6/conf/wlan0/disable_ipv6
Change the 1 to a 0 if you want to reactivate IPv6. Android resets this setting every time you connect to a network, so you might try Tasker to do this.
I still haven't found a solution for the ARP and DHCP requests though. Any help or input would be appreciated.
Thanks
___
Use the new BBS beta to check your wakelocks.
Click to expand...
Click to collapse
Thanks for this thread. Not sure if it will help or not but I have done all the things in the op and will report back. Have to start somewhere I guess. Although this isn't totally killing my battery in home .8% per hour will sleeping at night It by far is the biggest thing waking my phone. In 9 hrs I have 45 minutes of wake and 35 come from this. If I can get this under control I an sure I can get a little better battery performance. :good:
HP wireless printer
Hi, I have done everything you have listed, though I am still experiencing the wakelock. I have an HP wireless printer so I think this is the problem. Though, what could I do to stop it from creating the wakelock on my phone? This doesn't list what you need to do for the HP printer. Thanks in advance.
Any recommendations for a good modem/router that will not cause these wakelocks?
Sent from my Nexus 5 using xda app-developers app
For those who have tp link routers and get this wake lock, disable the print server in USB settings. It stopped almost all the RX_wake..
Before stopping I used to get some regularly spaced packets from 192.168.1.1 (router) to 255.255.255.255 UDP 7437 .. Bite completely stopped..
Hit thanks if I've helped you.
gpkumaran said:
For those who have tp link routers and get this wake lock, disable the print server in USB settings. It stopped almost all the RX_wake..
Before stopping I used to get some regularly spaced packets from 192.168.1.1 (router) to 255.255.255.255 UDP 7437 .. Bite completely stopped..
Hit thanks if I've helped you.
Click to expand...
Click to collapse
I might sound like a noob, but where do you find the USB settings to disable the print server?
grumpyfuzz said:
I might sound like a noob, but where do you find the USB settings to disable the print server?
Click to expand...
Click to collapse
in ur router setup page 192.168.1.1(probably)
Kyle C said:
Thank you for the post. It makes me nervous that I'm getting this wake lock. I previously got it on my GNex and Nexus7 (2012). I tried every method above to fix but got nowhere. For whatever reason my Nexus 4 didn't suffer from this. Hopefully I can figure something out for my new nexus 5
Click to expand...
Click to collapse
Have you figured anything out yet? I have also tried everything and still getting this wakelock also.
grumpyfuzz said:
Have you figured anything out yet? I have also tried everything and still getting this wakelock also.
Click to expand...
Click to collapse
Franco kernel working to fix this?
Momotani-Hitoshi said:
Franco kernel working to fix this?
Click to expand...
Click to collapse
It didn't work for me, but it might work for other people.

[Pry-Fi] Randomized MAC addresses during scans

It's not really the same thing as the Pry-Fi app - these patches provide much less functionality, but are also less troublesome - but I'm using the title anyway for association points.
These patches are meant to:
- Randomize your device's MAC address when scanning (but not connected)
- Prevent your device from leaking your entire SSID list periodically
(The app thread has a few examples about what and why, if you have no clue why we want this)
Not all devices support changing the MAC address based on this code. Known devices that do work are for example the Nexus 5 and Galaxy S4, and known devices that don't work are for example the Nexus 7 2013 and anything Sony. I did not notice any issues on the devices I tested on that didn't support this, though.
Relevant commits (also contain relevant information):
https://gerrit.omnirom.org/#/c/7970/
https://gerrit.omnirom.org/#/c/7971/
Building
These patches do not enable anything by default, you still need to set the Java bool config_pryfi to true in the right overlay, and add CONFIG_PRYFI := 1 to the right .mk file.
I would advise setting CONFIG_PRYFI_LOGGING to 1 as well, so you can check logcat to see if Pry-Fi mode is actually active - its reasonably chatty.
Testing
Testing behavior requires Wireshark (or equivalent) and a Wi-Fi chip you can switch to monitor mode (this excludes most Windows computers - I used a MacBook running OS X for this).
If you have all that setup, you can grab all relevant packets by setting the filter expression to "wlan.sa contains xx:yy" where xx and yy and are the second and third parts of your device's MAC address. Not the first, because that one differs between normal and P2P mode, and not the last three, because we randomize those by default.
Once you have that set up ...
Testing for PNO
If your device does not have PNO enabled in the first place (check the config_wifi_background_scan_support bool) you can skip this part. Or you can simply disable it and be done with that - enabling it does slightly improve battery life, though.
Basically you want to know if PNO leaks the SSID list (I've not found a device yet with PNO that doesn't do this, but I do not see a technical reason why they must).
Make sure your device is clean-ish so it occasionally goes to sleep. I test this on completely wiped devices myself.
Make sure your device knows several networks but that it's not connecting to any. You could for example use a second Android device to create a hotspot, connect to it with the test device, create another hotspot, connect to that with test device, etc. Do not add a network with the + button, as these will be leaked regardless.
Make sure you have Wireshark running with the right filter expression and monitoring, then unplug your device (it may not be powered!), turn off the device's screen, and leave it there for 30 minutes.
Now you can examine the Wireshark logs. You should see only SSID=Broadcast entries, and SSID=<network> entires for networks that it knows and are actually available (like your home Wi-Fi, but not the hotspot entries you created earlier that are no longer active).
If you see your entire list of network names come by, then PNO on this device is leaky and should definitely be disabled.
Testing for MAC changes
If you have Wireshark set up this is very easy. Make sure you note your original MAC address.
Then make sure your device is not connected to any Wi-Fi networks, and use the Wi-Fi setting's menu's Scan button.
Check the Wireshark logs for what MAC address the device is using. If it stays the same as your original MAC address, then MAC address changing is not currently supported on your device.
If you've confirmed that the MAC address does change, leave the device alone for a while (once unpowered and once powered) and check the Wireshark logs to see if your original MAC address ever appeared, or if it's currently using randomized addresses.
As last step, try connecting to an access point like your home Wi-Fi, and confirm the device has switched back to your original MAC address.
For bonus points, track what happens when using Wi-Fi Direct, WPS, and other Wi-Fi features. I have not checked this extensively yet, we may need further fixes.
Other stuff
Not really planning on expanding this much or keeping track of which devices do and don't work. Release was a tad rushed (so is this awful post) so my last test-cases may have broken some earlier ones. Regardless, this patch will require a number of users/maintainers to actively test on their devices and see what's what - that's way beyond what I can do on my own.

[ROOT] A simple guide to block/Reduce qcom_rx_wakelock and some other wifi wakelocks

Two weeks felt like two years when my phone suddenly started acting odd. High CPU usage, 2x battery drain compared to before, phone heating up while doing simple tasks drove me insane. I thought there might be something wrong with the phone but couldn't find anything so I sent it to the customer service center. All they did was factory reset, installed the latest stock OS, and sent it back which didn't solve my issue.
So I rooted the phone, installed a custom ROM and the problem was still there. I lost the tiny bit of hope I had left and concluded that it's a hardware issue and I might have to buy a new device. Two days later I installed the Better Battery Stats app and kept my phone idle overnight with wifi on.
The next day I finally found out what's been eating my battery. In BBS under Kernel wake-locks, I saw qcom_rx_wakelock was on for 8 straight hours, as long as my wifi was on. Checked the CPU states on the FK Kernel manager and found out the phone never went to deep sleep, not for a second! Also, there was that idle wifi usage.
So I downloaded the Network Log app and kept logging on the next night. 9 hours passed, none of my apps used the internet but the kernel used almost 500 mbs in 9 hours! So that's where my wakelock was coming from.
I went to my friend's house and used his wifi for a few hours to identify what's going on and I was surprised to see there was no battery drain, low CPU usage, and zero idle wifi usage. For a moment there everything seemed to went back to normal. When I came back to the school dormitory the nightmare started again.
I started scouring on the internet and I found this which led me to this terrific post!
This comment explains everything!
To summarize, the phone was going crazy because of wifi multicast, and arp flooding. I couldn't do anything about it as I was in the university's public wifi. You can disable multicast by going to the router page and turning off wifi multicast from IGMP snooping setting. But it was impossible for me cause school won't allow me to change anything and even if I complain they won't care.
So I decided to fix it by adding some of the Pixel 3's WCNSS_qcom_cfg.ini properties to my phone's WCNSS_qcom_cfg.ini which I located in the vendor/etc/wifi/ as r/skanadian recommended in the second post which took my qcom_rx wakelock to 19%, way less compared to 86% before.
This is a step-by-step guide to reducing battery drain -
• Backup your phone's WCNSS_qcom_cfg.ini in case something go wrong. I found it in system/vendor/etc/wifi/here
It might be different for you depending on what Rom or device you are using. The filename will be the same but the location might be different.
• Get a text editor. Mixplorer is recommended as it helps to search properties quickly with its find feature.
• Open your devices WCNSS_qcom_cfg.ini using Mixplorer and keep it open. Alternatively, you can copy it to a different folder on your phone. I suggest the second one cause it's better than directly editing the file from the system.
• Go to this page
• Go to your browser option and select find in page to search. Search for the word "offload" on that page.
• Copy all the lines related to offload one by one and replace them on your devices WCNSS_qcom_cfg.ini that you opened using Mixplorer.
• If there isn't anything to replace simply add those lines. Don't forget to hit the save button while doing that.
• After that, search for these properties on your WCNSS_qcom_cfg.ini and set them as I did below
RoamRssiDiff=3
g11dSupportEnabled=0
gEnablePowerSaveOffload=5
gRuntimePM=1
RTSThreshold=1048576
gMCAddrListEnable=1
gActiveMaxChannelTime=40
gActiveMinChannelTime=20
gMaxConcurrentActiveSessions=2
If you don't see one of these to replace in your WCNSS_qcom_cfg.ini you should add it.
• Now reboot your phone, give it some time and see if the battery improves. If everything remains the same then go to WCNSS_qcom_cfg.ini using Mixplorer again, find BandCapability, and set it like this -
BandCapability=1
It will disable 5ghz from your phone. I found out most companies release their phones with bad wifi drivers which don't handle the 5ghz wifi band appropriately. Lack of power-saving and not blocking multicast requests properly leads to higher CPU usage and bad battery life.
Again you can set the BandCapability=2 if you want to use 5ghz mode only. If you have a good wifi driver, the battery drain might come from switching between 2.5 and 5ghz so keeping on one of them helps.
• Why qcom_rx wakelock and what is the best fix?
It can occur for several reasons.
- Wifi multicasting. Multicasting can be disabled from IGMP snooping on router settings. You don't need multicasting in your home network at all. But when you're on office wifi or school wifi, it does improve the speed slightly by reducing data loss and interference. It also can be solved the same way but if your school management is like mine, then they might not care if your laptop or phone burns.
- DHCP timers
- A software bug from server-side
- Band switching
- Even interference, if you have a public network with a lot of phones and PCs
There are some more reasons I can not remember now. The best way to fix it is to build a custom kernel with WLAN and qcom_rx blockers/limiters e.g. Franko Kernel.
But sadly a lot of us will never have that unless we make a kernel for ourselves. So as of now, this is the solution I could come up with.
My knowledge of this sector is very little. It would be great if you all could help me get rid of this problem.
I would love it if there was a feature built-in on Android OS to block some kernel wake-locks.
OnePlus phones allow you to turn off multicasting from Developer Options but that makes little to no difference depending on what wifi you are using.
• Very Important :
Depending on you wifi, you can try setting hostArpOffload=0 and hostNsOffload=0
or you can try setting both to 1. Use whichever improves the battery backup. Don't forget to reboot after changing anything.
If you are an expert, please help us. Cause these wakelocks aren't going anywhere. They will give some of us many more sleepless nights.
Thank you for reading. Have a good day!
For those who don't want to change settings they don't understand:
RoamRssiDiff: The difference in signal strength required before phone will switch to a new Access Point. Measured in -dbs. 3 means it will switch APs if the signal strength is 3dbs better than the one in use.
g11dSupportEnabled: WIFI 802.11d
gEnablePowerSaveOffload: Level of Powersave
gRuntimePM: Runtime Powermanagement
RTSThreshold: How long to wait before asking to send wifi packets. Should be as high as possible, only lowered if you have wifi dropouts.
gMCAddrListEnable=1: Drops all Multicast frames except for ARP. You don't want to disable ARP entirely or your internet will break, so don't lower this to 0.
gActiveMaxChannelTime: Time spent scanning.
gActiveMinChannelTime: Ditto
gMaxConcurrentActiveSessions: Self-explanatory
While looking this up I also found gNeighborLookupThreshold or RoamLowRssiThreshold: The signal strength at which the phone starts looking for a new AP (the step before RoamRssiDiff becomes relevant). Typical values are 65-80. Changing this might help too if your phone is switching AP too often or not often enough.
Thanks for this, my device was also affected by this (though not as badly as yours) I've just disabled Multicast from my router.
TrenchFullOfSlime said:
For those who don't want to change settings they don't understand:
RoamRssiDiff: The difference in signal strength required before phone will switch to a new Access Point. Measured in -dbs. 3 means it will switch APs if the signal strength is 3dbs better than the one in use.
g11dSupportEnabled: WIFI 802.11d
gEnablePowerSaveOffload: Level of Powersave
gRuntimePM: Runtime Powermanagement
RTSThreshold: How long to wait before asking to send wifi packets. Should be as high as possible, only lowered if you have wifi dropouts.
gMCAddrListEnable=1: Drops all Multicast frames except for ARP. You don't want to disable ARP entirely or your internet will break, so don't lower this to 0.
gActiveMaxChannelTime: Time spent scanning.
gActiveMinChannelTime: Ditto
gMaxConcurrentActiveSessions: Self-explanatory
While looking this up I also found gNeighborLookupThreshold or RoamLowRssiThreshold: The signal strength at which the phone starts looking for a new AP (the step before RoamRssiDiff becomes relevant). Typical values are 65-80. Changing this might help too if your phone is switching AP too often or not often enough.
Click to expand...
Click to collapse
Cool!
There are some other wakelocks that's bothering me more than qcom_rx and I have no idea what they are!
Could you please tell?
Mario3DS said:
Thanks for this, my device was also affected by this (though not as badly as yours) I've just disabled Multicast from my router.
Click to expand...
Click to collapse
Sadly I'm on school wifi and can't do anything about it!
lpass is a Qualcomm audio subsystem for things like voice based wakeup, and IPCRTR (inter-process communication router) is just how different processes on your phone communicate with each other.
Others have reported these wakelocks too, almost always when they have a wifi/cell connection. Maybe it has to do with voice assistants communicating with their home servers?
TrenchFullOfSlime said:
lpass is a Qualcomm audio subsystem for things like voice based wakeup, and IPCRTR (inter-process communication router) is just how different processes on your phone communicate with each other.
Others have reported these wakelocks too, almost always when they have a wifi/cell connection. Maybe it has to do with voice assistants communicating with their home servers?
Click to expand...
Click to collapse
Well
I asked a kernel dev and he gave exactly the same explanation you gave me. He also said these are necessary and doesn't drain battery too much.
I am on a custom kernel now and wlan, qcom_rx wls are gone.
Thanks for the help
With the new kernel, I'm not seeing Lpass wakelocks much. They are there but limited.
TrenchFullOfSlime said:
lpass is a Qualcomm audio subsystem for things like voice based wakeup, and IPCRTR (inter-process communication router) is just how different processes on your phone communicate with each other.
Others have reported these wakelocks too, almost always when they have a wifi/cell connection. Maybe it has to do with voice assistants communicating with their home servers?
Click to expand...
Click to collapse
I see you've gained quite some knowledge regarding wakelocks. Your explanation was simple and easy to grasp. Could you please guide me to a thread where I can learn more about it?
Thank you so much
I just googled all the terms. Qualcomm publishes some of its stuff (source code and .ini files) with comments, others were referenced in AOSP sources.
Thanks for posting this, with my pixel 4a setting "hostArpOffload" to 0 solved it. NETLINK wakelok are much less and no battery drain.
Although on onePlus 7 pro which I've rooted few days ago none of this is working and NETLINK wakelok is draining battery at 2-3% per hr.
I'll try flashing a different ROM and If found any fix will post it here.
Device1 : Pixel 4a | LineageOS 18.1 | microG
Device2 : OnePlus 7pro | LineageOS 18.1 | microG
Edit : There are many multicast requests and NETBIOS requests too and looks like NETBIOS requests are coming from all the windows machines which are connected via Access point.
Edit:
Tried packet capture and Router is just flooding network with Multicast and ARP traffic.
I'm in the same situation as you since I live in University Campus so no router access, Have no idea how to solve this now.
A viable option is maybe buy your own router then use it as an extender and block all these garbage requests but no idea in extender mode will you be able to block stuff or not.
seated_singer said:
Thanks for posting this, with my pixel 4a setting "hostArpOffload" to 0 solved it. NETLINK wakelok are much less and no battery drain.
Although on onePlus 7 pro which I've rooted few days ago none of this is working and NETLINK wakelok is draining battery at 2-3% per hr.
I'll try flashing a different ROM and If found any fix will post it here.
Device1 : Pixel 4a | LineageOS 18.1 | microG
Device2 : OnePlus 7pro | LineageOS 18.1 | microG
Edit : There are many multicast requests and NETBIOS requests too and looks like NETBIOS requests are coming from all the windows machines which are connected via Access point.
Edit:
Tried packet capture and Router is just flooding network with Multicast and ARP traffic.
I'm in the same situation as you since I live in University Campus so no router access, Have no idea how to solve this now.
A viable option is maybe buy your own router then use it as an extender and block all these garbage requests but no idea in extender mode will you be able to block stuff or not.
Click to expand...
Click to collapse
OP 7 pro is the device you mentioned? I think it has custom kernels with bult in wakelock blockers that automatically blocks wlan, netlink and qcom rx.
Edit: Netlink can be blocked by using Custom kernel others wakelocks are due to ARP network flood. Turning it off from WCNSS_qcom_cfg or blocking introduces another problem of few seconds delay in connection ( due to ARP Resolving issue ) when switching from one access point to another ( only when automatic ) and since I do it quite often when roaming my University campus it's a hassle.
One way to mitigate this ( if you need to keep ARP offloading off ) is by using static IP, worked for me and my roommate too, but not viable since you need root. Finally I have set up my own router, checked and there were no wakelock.
Few of my friends are also facing this battery drain issue not on all Access points but some maybe after complaining authority will fix this.
Note : Netlink is only showing on Android 11/12 with other versions there are other wakelocks.
seated_singer said:
Netlink can't be blocked nor does it show since It's a part of kernel itself, here now about other two they are due to ARP network flood. Turning it off from WCNSS_qcom_cfg or blocking introduces another problem of few seconds delay in connection ( due to ARP Resolving issue ) when switching from one access point to another ( only when automatic ) and since I do it quite often when roaming my University campus it's a hassle.
One way to mitigate this ( if you need to keep ARP offloading off ) is by using static IP, worked for me and my roommate too, but not viable since you need root. Finally I have set up my own router, checked and there were no wakelock.
Few of my friends are also facing this battery drain issue not on all Access points but some maybe after complaining authority will fix this.
Note : Netlink is only showing on Android 11/12 with other versions there are other wakelocks.
Click to expand...
Click to collapse
I have NetLink blocked from kernel.
Some of this problems are impossible to fix from phone. So I contacted school management. They didn't believe me at first then I went to the head office and showed them with Network Log app that records every single packet.
A week later they fixed it. Contact your authority and see if it helps.
Thanks for the info mate, edited. Never thought I have to deal with this stupid WiFi problem.
RyanCr7 said:
Two weeks felt like two years when my phone suddenly started acting odd. High CPU usage, 2x battery drain compared to before, phone heating up while doing simple tasks drove me insane. I thought there might be something wrong with the phone but couldn't find anything so I sent it to the customer service center. All they did was factory reset, installed the latest stock OS, and sent it back which didn't solve my issue.
Thank you for reading. Have a good day!
Click to expand...
Click to collapse
Thanks for sharing, same thing happened to me..
Reading this post and turning off Multicast on both my wifi APs worked!
Just wanted to say that following this advice with all the Offload parameters, my wifi wakelocks have pretty much vanished so far on my nexus 4, i was getting something like 14000 wakelocks in battery guru. Thank you.
I can't understand why they don't specify what commands work for what Qualcomm chipset, since even though that is a newer phone, they still work on an older WiFi chipset, I've been mixing and matching for years.
KitsuneFoxy said:
Just wanted to say that following this advice with all the Offload parameters, my wifi wakelocks have pretty much vanished so far on my nexus 4, i was getting something like 14000 wakelocks in battery guru. Thank you.
I can't understand why they don't specify what commands work for what Qualcomm chipset, since even though that is a newer phone, they still work on an older WiFi chipset, I've been mixing and matching for years.
Click to expand...
Click to collapse
I'm glad it worked for you.

Categories

Resources