Results 1 to 3 of 3
Like Tree5Likes
  • 3 Post By Dog5000
  • 2 Post By MercuryStar
  1. Thread Author  Thread Author    #1  
    Dog5000's Avatar

    Posts
    561 Posts
    Global Posts
    960 Global Posts

    Lightbulb Demystifying Wakelocks

    I've seen recent posts that eventually end up talking about excessive or more than normal wakelocks. So, I started this thread as an informal Crowdsourced PSA to help shed further light on the subject.

    What I've gathered from some initial reading is that wakelock is an Android OS mechanism that applications can use to get work done by gaining access to system resources. Depending upon how app developers implement or access wakelock in their application, this in turn can either get access to the resources needed and then release the resources; or if not implemented properly or optimally can result in excessive resource consumption. If the latter state occurs, then more than expected or desired battery consumption could be the case. Additionally, the OS may not be able enter a sleep state that is conducive to expected light battery consumption when the phone is essentially at rest.

    Feel free to weigh in and add on with tips, ideas, and techniques or tools you've used to help determine if wakelocks are problematic.


  2. #2  

    Default Re: Demystifying Wakelocks

    Put much more simply:

    An application needs to apply for a "wakelock" if it wants to do something in the background even if the phone would otherwise go to sleep. A wakelock effectively prevents the phone fully going to sleep while the wakelock is in effect. This allows the application to finish whatever it wanted to do.

    There are legitimate reasons for applications to use wakelocks - this includes any application that needs to do something in the background while the phone is not being used, and it can't simply wait until the phone "wakes up".

    However, applications that make excessive or improper use of wakelocks run down the battery unnecessarily, and unfortunately there are many such applications.

    Only applications that have "Prevent the phone from going to sleep" permission when you install them are allowed to use wakelocks. If you are installing an app and it requests that permission, you may wanna keep an eye on its battery use. Apps that don't request that permission can't use wakelocks.

    The other vital thing to understand, and may be obvious to some but not others, is that just because your screen is off doesn't necessarily mean that your phone is asleep. When looking in the battery stats at how much time an application has kept the phone "awake", that doesn't necessarily mean the screen was on: the phone could have been working hard even while the screen was off. In this case "awake" vs "asleep" is referring not to the screen but to the CPU going into its sleep mode to save power, which is a different thing. This is the reason it's hard to tell what is using the battery without going into the battery stats.

    More info, for technical people:



    If you're concerned about the battery life used by an app, the in-built battery stats should give you a lot of useful information. Keep an eye out for an app whose overall battery use "bar graph" is way higher than the others (apart from "screen"). And for more detail on a particular app, you want to tap on the app itself. "Stay awake" is the specific stat associated with using wakelocks, however sometimes apps use wakelocks even when they're in the foreground, so if you have a high "Stay awake" value, but also a high "CPU foreground" value, it could mean that most of those wakelocks were used when the phone would have been awake anyway (nonetheless, it is still a helpful stat). The reason why some apps can still get stuff done without any need to use wakelocks is that they only react to interactive events such as key presses and screen touches that the device wakes up for anyway.
    Last edited by MercuryStar; 07-11-2013 at 10:54 PM.
    Thanked by 3:
    LadiJae and mumfoau like this.
  3. #3  

    Default Re: Demystifying Wakelocks

    Hi,

    We are a small team of developers and we were researching about wakelocks since awhile.

    You can take a look at these slides to learn more about wakelocks.

Similar Threads

  1. Replies: 6
    Last Post: 03-25-2014, 12:55 AM
  2. SD Card and Wakelock
    By ToddL in forum Verizon Galaxy Note 2
    Replies: 0
    Last Post: 06-13-2013, 02:40 PM
  3. Replies: 1
    Last Post: 05-10-2013, 04:48 PM
  4. Pinpoint AlarmManager Wakelocks?
    By SilentEcho in forum General Help and How To
    Replies: 25
    Last Post: 05-01-2013, 11:57 AM
  5. Google Wakelock hell
    By Andras in forum HTC EVO 4G LTE
    Replies: 1
    Last Post: 04-30-2013, 02:09 PM

Posting Permissions

B