FORUMS

Guide for hunting down wakelocks and battery drain (No Root)

62 posts
Thanks Meter: 26
 
By brokich, Member on 30th October 2017, 08:24 PM
Post Reply Email Thread
I've posted this guide on reddit already, but thought it might be useful here as well. A lot of users promote intense usage of package disablers to reduce battery drain, but this is not required to such an insane extend.

---

After experimenting with my S8 for 2-3 months now, I've collected some data and constructed some basic idea on how to fight wakelocks without having to root your device. I'll try to lay down everything here under a few categories.

First of all, I'll say that I tried using my S8 with a package disabler with hundreds of apps and services disabled, and also tried using it with no package disabler at all. I did not see a significant difference. It's too hard to determine if there is one, but I have to note that disabling TOO MUCH can actually hurt your battery usage.

Finally, I settled on using the device with a disabler again, only this time I disabled things strategically after some investigation with battery stats measurement and wakelock detection.

The apps I used were:
These are paid apps, but I am happy with what they can do. BK can be replaced with another disabler (as long as it gives you control over individual package services) and BBS can be replaced with GSam Battery Stats, which is free.

General tips on using these apps:
  • BBS will require your device to have USB debugging enabled, so that you can connect the phone to your PC and unlock the permission manually. You need an ADB command prompt to do that, and you need to give it the following permission with the following command (read more here).

Code:
adb -d shell pm grant com.gsamlabs.bbm android.permission.BATTERY_STATS
  • You can use BBS if you do not restart your phone while testing. If you do, it will wipe stats and likely not activate for another few hours, or until you charge again.
  • You should be using BBS to observe Deep Sleep percentage in the Summary tab (which should be above 95% when the phone is left in idle mode for hours), and Partial Wakelocks to find individual wakelocks that come from apps. Kernel wakelocks are hardly ever something you can do anything about and shouldn't be observed too much, no point in that unless you are rooted. The highest kernel wakelocks should be the ones related to your screen-on time - they are easy to point out as their awake time equals your screen on time.
  • BK Package disabler, or any other disabler for that matter, WILL require admin privileges to work on your device, so keep that in mind.
  • BK Package disabler should be used in tandem with BBS, only once you have found wakelocks and/or managed to understand which service is the actual cause. I will give examples below.

---

So, let's start.

Google Play Services battery drain

This one really sucks and it seems to plague any Android device at some point. Most often than not, this problem will occur after you do a system update without doing a factory reset. Last time it occurred on my S8 was right after I did the AQI7 update, after having very good idle drain previous to updating.

What to do in this case?
  • Log out of your Google account(s).
  • Enroll for Google Play Services BETA. To enroll, scroll down on this page and find the beta button OR Find Play services in your App list, and do "Uninstall updates", then update it right after that.
  • Turn off your phone and then boot it in recovery mode (Hold volume up + bixby key, then also hold power button) and select Wipe Cache - This will erase Dalvik cache.
  • Reboot the phone and delete system cache from the Storage settings
  • Log back into your Google account(s).
  • Charge your device and then observe idle drain overnight, or over a few hours.

If this process does not help your problem at all, you might have to do a factory reset to cure the services issue, or the problem might be related to something else, like a google service from some particular app. Use BBS to investigate wakelocks as you check your idle drain.

If this process helps you, but you see the issue again in future without changing anything, try going to the Developer Settings, look for active processes, and find Google Play services. Open them and then hit 'STOP' for each of their sub-services. Don't worry, they will restart on their own. After doing this, you might reboot your phone as well. Last time this little chore helped me out and the drain went away.

---

General Wakelocks

It's normal to get wakelocks even on a perfect system, but BBS will show exact percentages on each of them. Normal wakelocks usually show 0-1% of awake time for a session. If you start seeing numbers like 3%, 7% , 9%, or more, on some specific wakelock, then there is definitely a problem.

Wakelock battery drain will usually appear in your Android System/OS drain stats, so it's impossible to determine without an app.

The most common wakelocks for me are:

- *net_scheduler* wakelock - this one can be related to your WiFi connection. In order to fix it you should have access to the router's settings, and that is not always possible. If you do have access, you can try changing the Wi-Fi channel (choose channel based on Channel Width, for example 40Hz width on 2.4GHz network could use channel 11), and Beacon Interval (set the interval to the highest possible). I found this helped in my case. This wakelock can also be related to google play services - check the previous part of the post on how to possibly resolve the GPS issue. Also, the wakelock can appear under the icons of other apps, when there is little you can do to track down exactly why it happens.

- *com.google.android.gms.measurement* wakelock - this is a VERY common one in my case, and BBS usually shows it comes from Google Services, but always has a specific app icon next to it. In order to resolve this wakelock I had to do the following:

Open my package disabler and go through each app that might be using background data, or the app that is shown next to that wakelock, and then open their lists of individual services. I searched for:

1. AppMeasurementService
2. AppMeasurementJobService
3. Firebase... any service starting with Firebase in its name


These services are related to apps collecting some usage statistics on how you use them and sending them back somewhere, probably the app vendors. You do not need them for any app to be functional, and many apps don't have them. For some reason they can keep your device awake for long periods of time. I disabled them on ALL apps I could find them in and it seemed to resolve a lot of wakelocks after investigating the next following days. This process was probably one of the things that helped me the most with hunting down daily wakelocks as the drain is very stable for me now. For example, today I came back from work with 20 hours of phone usage since charge, almost 1h of SoT and 75% battery left. Other days, I have come back from home with 10 hours of usage, 1.5h of SoT and ~60%. I've seen a lot of improvement lately after doing all of the suggested things and keeping Google services at bay in parallel to that.

---

Bluetooth wakelock

This one was the most inexplicable to me. I never use Bluetooth, or turn it ON for any reason at all. I could not understand why the wakelock occurs.

Ultimately, my solution was to completely disable the Bluetooth System package and all services in it through the BK disabler.

I know this solution doesn't sound good to anyone, but at the same time it might be useful if you also do not use BT at all.

I plan to buy BT headphones in the near future and will be re-enabling this, and at that point I will start observing the behavior of the package once again and maybe turn it on/off at will if the wakelock re-appears too often.

---

Other wakelocks

The general rule here still applies. First, you record your usage with BBS. Then you note down which wakelocks appear on top, and google them as best as you can. Search is your friend here, as the wakelocks are endless and it is impossible for me to list them all and give solutions for even a small percentage of them. Sometimes you might get lucky and find an easy fix. In other times, there will be no easy explanation, or no explanation at all. Such is the nature of Android.

In some cases the wakelocks might be specific services that you can disable for specific apps. In other cases, they will be too general and it will be unclear why they occur. For example, I sometimes get *net_scheduler* wakelock with the Viber app, that can last for 20-30 minutes at random times, and still have not found a way to resolve that, other than uninstalling Viber completely (which is not a bad idea but sadly some of my contacts insist on using that crap. Telegram is your friend).

---

General Tips:
  • Use an AMOLED black theme. System theme from Samsung Themes (!) and individual app themes / status bar from Substratum. Do not use overlays for the system UNLESS you do not use samsung themes. I found out that Samsung themes do a better job at painting all system apps black, while some substratum overlays miss a few things. It will also be a LOT less painful to update overlays as you uninstall all of them and re-install them, because using Samsung for the system means less packages from Substratum to be installed. REMEMBER to always uninstall system overlays and statusbar overlays (ALL overlays if you want to be super safe) before doing a system update! Otherwise you can soft-brick your device.
  • Use auto-brightness and make sure to make it as low as you are comfortable with in rooms that you stay often in (like your own room, your office room, etc). Smart auto-brightness will remember you preference and you will hardly ever use more brightness than you need.
  • Turn off notifications for any apps that are not essential to you. In fact, I have turned off everything except Gmail, because I have a habit of checking my phone very often and do not miss out on anything, while notifications have become a bit annoying to me anyway.
  • Put almost all of your apps to 'Always Sleeping' in the device optimization app.
  • Do NOT always sleep apps that you need to be awake, like your Messaging app, Home Launcher, utility stuff like Navbar Apps, Keyboard. Put those in the 'Unmonitored' category instead.
  • DE-OPTIMIZE your fingerprint scanner from battery optimization settings if you are having issues with waking up the device with it. It is optimized by default if I remember correctly.

If you are feeling BRAVE, you can do your own investigation for each app that you use often to look for any services that might look like Analytics services. Experiment at your own risk, but generally such services are always a benefit to turn OFF for both battery and privacy reasons.

---

Overall, that's it. If I remember something, I will update the thread. Hopefully this can help someone.

In my personal results, I've managed to achieve a 0.3% idle drain per hour with Wi-Fi active during a test of 12 hours of standby. As visible in the screenshot, the Wi-Fi signal is not even perfect.

Here is an example of idle drain with about 1h 10m of SoT at the time it was taken.

---

Feel free to use this guide in conjunction with Neomancr's general battery and performance tuning guide
The Following 10 Users Say Thank You to brokich For This Useful Post: [ View ] Gift brokich Ad-Free
30th October 2017, 09:05 PM |#2  
magarto's Avatar
Senior Member
Flag Madrid
Thanks Meter: 108
 
More
Thanks!
1st November 2017, 07:44 PM |#3  
OP Member
Thanks Meter: 26
 
More
Quote:
Originally Posted by magarto

Thanks!

No problem!
17th February 2018, 06:26 PM |#4  
Member
Thanks Meter: 8
 
More
This should be on top! Thanks a lot!
The "Service Disabler" functionality has been removed from the latest app version due to Google Play policies.
Fortunately we can find the previous apk version in the developers website.

https://kunkunsoft.wordpress.com/news_2/

Cheers!
1st March 2018, 01:44 PM |#5  
Member
Thanks Meter: 3
 
More
hey thanks a ton for this article! My battery is horrible...REALLY. 2 h ost...I've just completed the first part. please explaind better what do you mean with "sign out from Google accounts" step by step. and in my case BBS was not adb enabled...I was not able to see wakelocks. the command explained here https://alexus.org/howto/better-batt...ts-no-root/amp (the google play store version) granted permissions for me. maybe you want to update the guide! I'll let you know how it goes.

cheers
1st March 2018, 06:17 PM |#6  
dancrow's Avatar
Senior Member
Thanks Meter: 138
 
More
@brokich
Could you please point us exactly to what are the main apps with AppMeasurement and Firebase services?
Until now I have found only the Google play store app.
Thanks for your great guide.
1st January 2019, 03:22 PM |#7  
Member
Thanks Meter: 0
 
More
Thanks for the guide. Starting to debug battery issues. Meanwhile tried setting up the black theme. What do you mean by installing only Samsung theme? Do you mean a specific theme made by Samsung electronics or any black theme from Samsung theme market?
2nd January 2019, 07:55 AM |#8  
Senior Member
Thanks Meter: 20
 
More
Here are the correct adb commands to BBS, as shown in the app in first start:
adb -d shell pm grant com.asksven.betterbatterystats android.permission.BATTERY_STATS
adb -d shell pm grant com.asksven.betterbatterystats android.permission.DUMP
adb -d shell pm grant com.asksven.betterbatterystats android.permission.PACKAGE_USAGE_STATS
The Following 2 Users Say Thank You to froma72 For This Useful Post: [ View ] Gift froma72 Ad-Free
Post Reply Subscribe to Thread

Guest Quick Reply (no urls or BBcode)
Message:
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes