Wireless charging is perhaps one of the best examples of true convenience. The simple act of setting your phone down meant its battery would begin refilling. No need to hunt for the end of a cable, no more time spent clumsily aligning plugs, and no more hassle with loose cords. When the Nexus 4 was announced, its stylish charging orb was supposed to spearhead a movement of wireless bliss. While the orb certainly had its advantages, it was a bit late to launch and carried a premium price. Nevertheless, Qi-compatible chargers began to find a home with Nexus 4 owners. Unfortunately, the update to Android 4.2.2 brought with it a wakelock bug that could seriously eat away at the battery life of Google's flagship phone after it had charged wirelessly.

Allow me to briefly explain wakelocks. They are part of a mechanism used by Android for power management, allowing applications to keep parts of the device awake while allowing other parts to go to sleep. This system is important for things like syncing email while the phone is not in use, or keeping the screen on while Maps is giving turn-by-turn directions. As necessary as this system may be, badly written apps and services have a tendency to misuse it, which contributes to the reputation of poor battery life in the Android ecosystem.

Unlike powering your phone through a wire, wireless chargers lack the ability to go into a low-power mode, often called trickle charging. Instead, the phone alternates between drawing power and living on the battery. Ideally, this will allow the battery to hover near to 100% without wasting electricity or damaging it from overcharging. The new code in Android 4.2.2 introduced a system for actively managing these continual changes and prevents the phone from regularly chiming every time the power pauses. You can probably guess where all of this is headed; a wakelock by the name of PowerManagerService.WirelessChargerDetector is used to keep the processor from falling asleep while this processing is quietly going on behind the scenes.

This finally brings us to the problem: the new wakelock isn't always released when the Nexus 4 leaves the charger. As a result, the processor is kept idling at 384 MHz, never allowed to enter a deep sleep, which drains the battery fairly rapidly. Several people are reporting that the Nexus 4 can normally last up to 2 days on a single charge. However, when this bug comes out of the woodwork, battery life often falls to 8-12 hours.

2013-08-20 14.23.412013-08-20 14.23.472013-08-20 14.23.53

While the issue seems to be more common for some people than others, no specific set of steps has been found to reliably replicate it. Reports in the AOSP Issue Tracker and the Google Product Forum indicate that the problem is not limited to any particular wireless charging pad, but a few people have seen inconsistent results between models. If you would like to test for this behavior on your own device, Better Battery Stats (XDA Thread) does an excellent job of tracking wakelocks and other power-hungry processes.

Despite first being reported 6 months ago with the rollout of Android 4.2.2, and then persisting into 4.3, the Android team has yet to formally confirm the issue or assign it to an engineer to be fixed. Thus far, Paul Wilcox (he is the public face of the product forum) has only acknowledged that the team is "still looking into it," but gives no further details. Of course, if you can contribute anything that may be helpful in solving this issue, head over to the forums and leave a comment.

For those affected by the issue, the only reliable method for clearing the bug is to reboot your phone. The wakelock will not reappear until a wireless charger is used again, so your Nexus 4 should be safe until it needs juice again. Of course, you can always return to using wired power until Google fixes this, but that kinda defeats the purpose of an expensive charging pad.

Thanks, Nick Hoadley and Jon Bross.

[AOSP Issue Tracker, Google Product Forum, AOSP code, XDA 1, 2]