[Android General] RyanCr7:
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!