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.
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.
Portions of this page are modifications based on work created and shared by the Android Open Source Project
and used according to terms described in the Creative Commons 2.5 Attribution License. AndroidCentral is an independent site
that is not affiliated with or endorsed by Google.