Skip to main content

Study Blames Smartphone Battery-life on Programming Errors

A team of scientists at Purdue University blames developers making programming mistakes for smartphones that end up with empty batteries in as little as five hours. Described as "no-sleep energy bugs" the researchers said that human error may be the cause for the flawed use of APIs that tell the software when to keep a phone awake or when to put in its sleep mode to save energy. An app that keeps the phone hardware awake to check incoming messages, for example, may lack the necessary code to put it back to sleep mode when the process is done.

"App developers have to explicitly juggle different power control APIs that are exported from the operating systems of the smartphones," Charlie Hu, professor of electrical and computer engineering at Purdue University, said.

"Unfortunately, programmers are only human. They make mistakes when using these APIs, which leads to software bugs that mishandle power control, preventing the phone from engaging the sleep mode. As a result, the phone stays awake and drains the battery."

Apparently, these bugs are not an isolated issue, but a rather common problem. The researchers looked at 187 different apps and found that 42 contained errors in their wakelock code. To counter the problem, the researchers developed a modified compiler that includes a tool that analyzes the binary code and automatically and "accurately detects the presence of the no-sleep bugs". Using the software, they found a total of 42 coding errors in those 187 applications - 12 previously known mistakes as well as 30 new flaws.

The research was limited to Android apps and phones, but Hu said that the same types of bugs appear on other platforms and devices as well.