A few days ago, we reported that the Facebook app had been updated, and now included “less suck”; turns out we may have been wrong (that pun will make sense in a minute). Flipz, the developer behind the awesome Fresh ROM’s, has done his homework and found that the updated Facebook App has a wake lock bug that drains the battery fairly significantly.

As mentioned, the problem arises from the wake lock. Wake lock is intended to keep parts of the phone running - typically the screen, but it can be configured to turn the screen off and leave the internal hardware on. The latter method is called a “Partial wakelock” and is the method used by the Facebook app - the screen is off, but everything else chugs along as if it the phone is in use. Flipz directly quotes the Android Developer site (and now I’m quoting him quoting it... how very Alice in Wonderland):

Device battery life will be significantly affected by the use of this API. Do not acquire WakeLocks unless you really need them, use the minimum levels possible, and be sure to release it as soon as you can.

If you hold a partial wakelock, the CPU will continue to run, irrespective of any timers and even after the user presses the power button.


Without going into more detail, what this basically means is that even when your phone isn’t in use, the Facebook app may cause it to continue to burn through CPU cycles (and RAM/ROM cycles, for that matter). The end result is that your battery life takes a significant hit.

I noticed this yesterday after I updated my Facebook app the night before, but I also flashed a new CM6 nightly and I (incorrectly) assumed that was the cause of the power drain. The power drain was fairly substantial - with the same usage conditions (and unplug time and time-frame), my battery was at 38% when I went to bed, while it’s normally around 54%.

Hopefully it won’t take Facebook as long to fix the wake lock issue as it did for them to come out with a decent App - if so, we probably won’t get a fix until mid-2012 (*zing*).

Update: Facebook acknowledged the issue today and promised a quick fix. Indeed, a few hours later, an update to 1.3.1 showed up in the Android Market, resolving the issue:

Hi folks, a number of you have commented on seeing a battery drain on your device since installing the new Facebook for Android app. We have identified the bug that is causing this battery drain and are working on a fix now. As soon as the patch is ready, we will push out an update. Thanks for the quick feedback and for your patience as we get this fixed!

[Source: GeekFor.Me]