Introducing No Wakelock

Hi, No Wakelock is a new Android app I developed. It gives user the ability to disable wakelocks of specified apps, which are usually the root cause of battery drain. It requires Xposed to function normally.

How it works?

Android allows apps to use partial WAKE_LOCK to keep devices awake while screen is off. However, this mechanism is often abused as some Android developers introduced it into network related operations. As a matter of fact, network events will wake devices up automatically and only pure CPU operations require wakelocks to prevent device from falling asleep.

Disabling partial WAKE_LOCK is usually safe and has little impact on the functionality of Android apps, except if you are doing CPU intensive work like video rendering, π calculation etc.

How to use it?

First of all, enable the Xposed module.

Screenshot_2015-10-01-09-40-52

It is recommended to use No Wakelock with other apps like Greenify. If you do not wish to have an app running in the background while screen is off, simply greenify it. If you have an app that you wish to have it running in the background, but at the same time want to minimize its battery usage, then do not greenify it. Instead, use No Wakelock to restrict its access to wakelocks.

It is recommended to identify the apps that use excess wakelocks first. Tools that can help you with that include Wakelock Detector.

Screenshot_2015-10-01-08-51-56

Then open No Wakelock, locate the app you want to disable.

Screenshot_2015-10-01-09-08-38

Then, choose the types of wakelocks you want to disable.

What to disable?

Partial Wakelock: This is the wakelock that prevents your CPU from falling into sleep while screen is off.

All Other Wakelocks: This is the wakelock that prevents your screen from turning off.

Sync Adapters: Sync Adapters can also keep devices awake. If you do not need synchronisation, you can disable it.

Align AlarmManager Wake-ups: (>= Android 4.4 only) Use this option to force align all wakeups caused by AlarmManager so that the CPU can keep asleep for as long as possible. Please be reminded that this option might postpone or break push notifications of apps that are improperly designed.

These four options should be enough for 99% of the users. However, if you wish to have more precise control over your phone’s wakelocks, you can enable this option:

Apply Custom Black/Whitelist: This is an advance option. Common users usually do not need to touch this unless you are clear what you are doing. If you wish to enable it, please edit the custom black/whitelist first. For more information about black/whitelist, read the next session.

  • Setup Example: Google Play Services

If you are using Google Play Services, it may be consuming too much battery. So you checked the battery usage of Google Play Services, and it turned out that Google Play Services is keeping your device awake even when you are not using it. To save your battery, open “No Wakelock”, navigate to Google Play Services (Enable system apps first in No Wakelock settings), disable partial wakelock and leave everything unchanged. Restart your device to make this effective.

Google Play Services will now no longer consume too much battery. The best part is that GCM notifications & Google Account Sync are all working as normal. Woohoo!

Screenshot_2015-10-01-09-08-48

Force stop the app(if you only change the settings of one app) or reboot your devices(if you changed the settings of a lot of apps) to make all settings effective.

Screenshot_2016-02-14-00-06-48

That’s all. Your device can have a good night’s sleep now.

Advanced Option: Black/WhiteList

Please be reminded that this is only for advanced users.

If you decide to enable it, the priority of wakelock matching becomes: blacklist > whitelist > other settings for the app.

To edit your black/whitelist, click the “Edit” button on the top right and fill in the black/whitelist in corresponding columns.

Black/Whitelist works in the way that matches wakelocks’ names. You can write regular expressions on each line. For instance, if you saw a wakelock named WakeLock:12345 & a wakelock named WakeLock:abcde are keeping your device awake, you can fill in these content in your blacklist:

WakeLock:\d+
WakeLock:[a-zA-Z]+

Please be reminded that one and only one regular expression should appear on each line. Do not insert extra new lines as this will invalidate all settings for this app.

Get it now!

Download No Wakelock at Google Play: https://play.google.com/store/apps/details?id=com.linangran.nowakelock

Purchase Donation Pack at Google Play: https://play.google.com/store/apps/details?id=com.linangran.nowakelock.donation

12 thoughts on “Introducing No Wakelock

  1. Aman

    If we disable all three wakelocks… It would stop letting that app to wake at all right?
    I have the donation pack…

    Kindly mail me back because i find this usefull and very capable to beat all the wakelock apps exist in playstore..

    Thanks:)
    Waiting for revert asap 🙂

    Reply
    1. admin Post author

      The CPU will not be woken by that app for a long time. However, there is another kind of way to wake up the CPU, it is the AlarmManager. But disabling AlarmManager might cause some app functionality to behave incorrectly – especially push notifications.

      But don't worry, AlarmManager cannot keep your device awake for a long time, and starting Android 4.4 the system is able to handle them in a very battery efficient manner.

      Reply
  2. Mike

    What if the app in question crashes when the system refuses to give it the wake lock it requested?

    This is what happens on my Galaxy Note 2, running Cyanogenmod 12.1. Google Play Services is constantly getting wake locks never letting the CPU sleep. If I use Cyanogenmod PrivacyGuard to block Google Play Services from getting wake locks, it crashes every 10 seconds with a system modal dialog popping up. This makes my phone unusable.

    I'd like to give Google Play Services a fake wakelock so it thinks it has one, doesn't complain or crash, yet can't keep the CPU awake all the time. Is that possible?

    Reply
      1. Mike

        Yes I'm having a problem with this, but not with your app "No Wakelock". Cyanogenmod's built-in Privacy Guard can deny wake locks to any app. Problem is, some apps crash when their request for a wake lock is denied. Google Play Services is like this. When its wake lock is denied, it crashes, pops a system modal dialog, then restarts, 10 seconds later crashes again. Thus every 10 seconds a system modal dialog pops up, making the entire device unusable.
        This is bad programming practice in Google Play Services. The only way around it would be to give it a fake wakelock, so it can't keep the CPU awake all the time, yet doesn't crash either.
        If your "No Wakelock" app could give fake wakelocks, it might be an alternative to Cyanogenmod's built-in feature. I guess not – too bad!

        Reply
        1. admin Post author

          I have no problem with No Wakelock taking effect on Google Play Services on my device. Your experience might vary due to different roms & devices.

          Reply
  3. alex

    Hi,

    I have a kernel wakelock called LEDs Wakelock that is killing my battery life as it does in many Chinese phones that have the same kernel. Is this app able to avoid these type of wakelocks or only wakelocks of apps? I don't know hot to solve my issue otherwise…
    Thank you!

    Reply
  4. Vik patel

    I have the donation package and having issues with Google play services (*net_scheduler*) keeping the device awake most. I've followed what you said and disabled the partial wake lock for googleplayservices but still this is not helping.

    Reply
    1. admin Post author

      1. Are you tuning the right app? Google Play Services & Google Search are two different apps.
      2. This app reduces the wake-up <strong>time</strong>, rather than the wake-up <strong>times</strong> . If the wake up time is reasonable it's OK if the number of times is high.

      Reply
  5. phantom146

    Hello! Is it ok to disable partial wakelocks in android system? I've been using this for quite a long time but Im really scared to try it since I dont have any backups… Would you recommend it?

    Anyway great app! Im qyite curious why you're not posting this on xda

    Reply
    1. admin Post author

      You can use it to restrict Google Play services but I would recommend not to touch the core system part.

      Reply

Leave a Reply

Your email address will not be published.