Thursday, August 23, 2012

Deleting Battery Stats - Fact or myth?

In almost every single Android device out there, the question of battery drain has inevitably been asked before. Along with this question, the subject of battery calibration has became a hot topic of debate among users.

One very common practice of battery calibration includes the wiping of the battery stats file (batterystats.bin). I have done this countless times as I flashed ROM after ROM. However, I was never clear as to how wiping this file would do to help get a more accurate reading in on my phone.

Well, I just came across a post from a Google employee who answers that very question!

The short answer is: Wiping the batterystats.bin does ABSOLUTELY NOTHING!

Amazed? Confused? Read on.

According to Dianne Hackborn, who wrote the code for battery stats, the file is only used to keep track of which application to be blamed for battery usage (which is displayed when you go to "Battery Use"). You read it right. The file is only keeping track of which process uses the battery. It does not store battery percentages or any information to tell the battery how much charge it should have.

In fact, this stats file is supposed to be cleared every time you unplug your phone when it has been fully charged, hence the clearing of the battery use page when you unplug after full charge but it still has the old graph/data when it is still being charged or unplugged before being fully charged.

Quote from Dianne Hackborn:
"This file is used to maintain, across reboots, low-level data about the kinds of operations the device and your apps are doing between battery changes. That is, it is solely used to compute the blame for battery usage shown in the "Battery Use" UI in settings.

That is, it has deeply significant things like "app X held a wake lock for 2 minutes" and "the screen was on at 60% brightness for 10 minutes."

It has no impact on the current battery level shown to you.

It has no impact on your battery life."

Therefore, the next time you want flash a new ROM or do a battery calibration by fully charging or discharging your battery, you can skip the very useless step of wiping the batterystats.bin.

Dianne Hackborn's post

No comments:

Post a Comment