Y. Charlie Hu
Samuel P. Midkiff
Despite their immense popularity in recent years, smartphones are and will remain severely limited by their battery life. Preserving this critical resource has driven smartphone OSes to undergo a paradigm shift in power management: by default every component, including the CPU, stays off or in an idle state, unless the app explicitly instructs the OS to keep it on! Such a policy encumbers
app developers to explicitly juggle power control APIs exported by the OS to keep the components on, during their active use by the app and off otherwise. The resulting power-encumbered programming unavoidably gives rise to a new class of software energy bugs on smartphones called no-sleep bugs, which arise from mishandling power control APIs by apps or the framework and result in significant and unexpected battery drainage.
This paper makes the first advances towards understanding and automatically detecting software energy bugs on smartphones. It makes the following three contributions: (1) we present the first comprehensive study of real world no-sleep energy bug characteristics; (2) we propose the first automatic solution to detect these bugs based on the classic reaching definitions dataflow analysis algorithm; (3) we provide experimental data showing that our tool accurately detected all 14 known instances of no-sleep bugs and found 30 new bugs in the 86 apps examined.
Public Review uploaded by lzhong:
This public review was prepared by Lin Zhong
This paper systematically studies an important problem: identify bugs in smartphone applications that keep the device or its component from going to sleep and drain the battery. It does so with the popular Android platform and identifies the misuse by applications of Android's wakelock mechanism as the key source. The paper also reports a systematic characterization of no-sleep bugs caused by the misuse and shows that standard dataflow analysis methods can be used to identify them with fair success when application source code is available or the application can be decompiled. Technically, the work is impressive in its depth as the authors focused on a single important problem and its use of program analysis techniques to solve system problems. Practically, resulting solutions from this work are immediately useful to both end users and developers of Android smartphones.
The work is limited in the following regards. First, it is highly specific to Android, in particular its use of wakelock, without offering much insight into other smartphone platforms such as iOS and Windows Phone. Although no academic papers have been published before about the problem with wakelock, the problem indeed has been well-known in the Linux community . Indeed, in 2010, the Linux kernel community refused to include patches for wakelock by Google into the main kernel tree . Second, the solutions from this work require an Android application to be decompiled when source code is not available. The authors were able to decompile only 86 out of 500 applications studied. This further limits the benefit to end users, although the solutions can be highly useful to application developers.
The specific problem tackled is Android-specific and the solution may have vanishing value moving forward since the use of wakelock in Android is likely to be obsolete in the future. On the other hand, this work opens a new direction by tackling no-sleep bugs, more generally energy bugs, which are likely to haunt mobile users of all platforms for years ahead. While the system and program language researchers have extensively studied bug-finding in general systems, mostly servers and personal computers, we look forward to more bug-finding work for mobile platforms like this one.
 Matthew Garrett, "Android/Linux kernel: Lessons learned," 2010 (https://events.linuxfoundation.org/slides/2010/linuxcon2010_garrett.pdf)
 Rafael J. Wysocki, "Technical Background of the Android Suspend Blockers Controversy," November 2010 (http://lwn.net/images/pdf/suspend_blockers.pdf)