'No-sleep energy bugs' drain smartphone batteries

Jun 13, 2012 by Emil Venere

(Phys.org) -- Researchers have proposed a method to automatically detect a new class of software glitches in smartphones called "no-sleep energy bugs," which can entirely drain batteries while the phones are not in use.

"These energy bugs are a silent battery killer," said Y. Charlie Hu, a Purdue University professor of electrical and computer engineering. "A fully charged can be drained in as little as five hours."

Because conserving battery power is critical for smartphones, the industry has adopted "an aggressive sleep policy," he said.

"What this means is that smartphones are always in a , by default. When there are no active user interactions such as screen touches, every component, including the central processor, stays off unless an app instructs the operating system to keep it on."

Various background operations need to be performed while the phone is idle.

"For example, a mailer may need to automatically update email by checking with the remote server," Hu said.

To prevent the phone from going to sleep during such operations, smartphone manufacturers make , or APIs, available to app developers. The developers insert the APIs into apps to instruct the phone to stay awake long enough to perform necessary operations.

"App developers have to explicitly juggle different power control APIs that are exported from the operating systems of the smartphones," Hu 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."

Findings are detailed in a research paper being presented during the 10th International Conference on , Applications and Services, or MobiSys 2012, June 25-29 in the United Kingdom. The paper was written by doctoral students Abhinav Pathak and Abhilash Jindal, Hu, and Samuel Midkiff, a Purdue professor of electrical and .

The researchers have completed the first systematic study of the no-sleep bugs and have proposed a method for automatically detecting them.

"We've had anecdotal evidence concerning these no-sleep energy bugs, but there has not been any systematic study of them until now," Midkiff said.

The researchers studied 187 Android applications that were found to contain Android's explicit power control APIs, called "wakelocks." Of the 187 apps, 42 were found to contain errors - or bugs - in their wakelock code. Findings showed the new tool accurately detected all 12 previously known instances of no-sleep energy bugs and found 30 new bugs in the apps.

The glitch has been found in interactive apps, such as phone applications and services for telephony on Android that must work even though the user isn't touching the . The app may fail to engage the sleep mode after the interactive session is completed.

Smartphone users, meanwhile, don't know that their phones have the bugs.

"You don't see any difference," Hu said. "You put it in your pocket and you think everything is fine. You take it out, and your battery is dead."

To detect bugs in the applications, the researchers modified a tool called a compiler, which translates code written in computer languages into the binary code that computers understand. The tool they developed adds new functionality to the compiler so that it can determine where no-sleep bugs might exist.

"The tool analyzes the binary code and automatically and accurately detects the presence of the no-sleep bugs," Midkiff said.

The Purdue researchers have coined the term "power-encumbered programming" to describe the smartphone energy bugs. Researchers concentrated on the Android smartphone, but the same types of bugs appear to affect other brands, Hu said.

Explore further: Blink, point, solve an equation: Introducing PhotoMath

More information: What Is Keeping My Phone Awake? Characterizing and Detecting No-Sleep Energy Bugs in Smartphone Apps

ABSTRACT
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 signi?cant and unexpected battery drainage. This paper makes the ?rst advances towards understanding and automatically detecting software energy bugs on smartphones. It makes the following three contributions: (1) We present the ?rst comprehensive study of real-world no-sleep energy bug characteristics; (2) We propose the ?rst automatic solution to detect these bugs based on the classic reaching de?nitions data?ow analysis algorithm; (3) We provide experimental data showing that our tool accurately detected all 12 known instances of no-sleep bugs and found 30 new bugs in the 86 apps examined.

Related Stories

Free apps drain smartphone energy on 'advertising modules'

Apr 04, 2012

(PhysOrg.com) -- Researchers have shown that popular free smartphone apps spend up to 75 percent of their energy tracking the user's geographical location, sending information about the user to advertisers and downloading ...

Google raises bounty on software bugs

Apr 23, 2012

Google on Monday raised to $20,000 its bounty on software bugs that hackers could exploit for cyber attacks on the Internet giant's online services.

Repulsive smell could combat bed bugs

Mar 31, 2011

In recent years, bed bug infestations have become increasingly common in Swedish homes. There are two different species of bed bug that suck blood from humans – the common bed bug and the tropical bed bug. Increased ...

Smartphone app illuminates power consumption

Nov 20, 2009

(PhysOrg.com) -- A new application for the Android smartphone shows users and software developers how much power their applications are consuming. PowerTutor was developed by doctoral students and professors ...

Recommended for you

How to find a submarine

1 hour ago

Das Boot, The Hunt for Red October, The Bedford Incident, We Dive At Dawn: films based on submariners' experience reflect the tense and unusual nature of undersea warfare – where it is often not how well ...

Google offers peek into Bhutan with Street View launch

3 hours ago

Google provided a sneak peek into Bhutan Thursday by unveiling a Street View project for the remote Himalayan kingdom, featuring panoramic views of its majestic mountains, monasteries and crystal-clear rivers.

Nokia turnaround since handset unit sale continues

5 hours ago

Nokia appears to have turned around its fortunes after the sale of its ailing cellphone unit to Microsoft, reporting a third-quarter net profit of 747 million euros ($950 million), from a loss of 91 million euros a year earlier. ...

User comments : 2

Adjust slider to filter visible comments by rank

Display comments: newest first

baudrunner
1 / 5 (1) Jun 13, 2012
Could be just bad coding practices. An on phone is never fully asleep because constant polling of the airwaves is necessary just to answer a call. I would suggest a hardware polling device using capacitance switching in a blocking diode circuit that simply trades energies without using battery power.
tthb
1 / 5 (1) Jun 13, 2012
...trolls?