Characterizing and Detecting No-Sleep Energy Bugs in Smartphone Apps
Document Type Article
Despite their immense popularity in recent years, smartphones are and will remain severely limited by their battery life. Preserving this crucial resource has driven smartphone OSes to undergo a paradigm shift in power management: by default every component, including the CPU, stays off or in 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, ideally only during their active usage by the app. 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 mis-handling power control APIs by the apps or the framework and result in unexpected, significant battery drainage. The paper makes the first advances towards understanding and automatically detecting software energy bugs on smartphones, and makes the following three contributions: (1) we present the first comprehensive real world no-sleep energy bug characteristic study; (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 known instances of known no-sleep bugs in the 500 benchmarks examined and found 51 new bugs.