yashsingh1/xdaforums huggingface dataset:
[Captivate General] wgarrido:
Thought I would post this

http://www.androidcentral.com/wiping-battery-stats-doesnt-improve-battery-life-says-google-engineer

Probably still helps with other things since people reported other things improving.
[Captivate General] zeropants:
I came here to post something similar to this. Wiping the stats or calibrating the battery doesn't actually improve battery life. Battery life is dependent on the rom and kernel you're using as well as the programs you have that might be running in the background.

All the stats do is help you get a more accurate reading within a days after doing the wipe on a full charge and letting the battery drain. Though the report is more accurate, it doesn't actually get you better battery life.
[Captivate General] joeybear23:
Feel free to read the first post. This process is not meant to improve battery life, and anyone who expected it to did not read the first post. All this process does is help your operating system to more accurately read your battery state. It is possible you may better utilize your battery if Android improperly reads a 70% full battery as 100% or 20% as 0%. But this is an extreme example, if you're battery stats are off it is most likely just a few percentage points on either end of the spectrum.

Warning: Created with Swype
[Captivate General] Entropy512:
No, it doesn't do any of that.

Read the MAX17040 datasheet at http://www.maxim-ic.com/datasheet/index.mvp/id/6621

Then read the kernel source, specifically the MAX17040 fuel gauge driver. Note the complete lack of any inputs other than a reset command to the fuel gauge chipset.

If those are too difficult for you to read, please read Dianne Hackborn's post - she's a senior developer at Google - https://plus.google.com/105051985738280261832/posts/FV3LVtdVxPT

Then please stop perpetuating completely baseless myths with zero evidence whatsoever to support them, and multiple sources of evidence (the IC datasheet, the kernel source for said IC, a Google engineer, and Cyanogenmod source code to see what batterystats.bin does) saying that you're just blindly flailing around cluelessly.
[Captivate General] Entropy512:
It doesn't even help you do that. It does NOTHING in terms of state of charge estimation, NOTHING.
[Captivate General] joeybear23:
I never suggested that wiping the file improved battery life, and it is certainly possible it has just been placebo effect over the past few years for hundreds of users.

However, it is also possible the process as outlined in the OP (full discharge/full charge) changes what the firmware reports as 100% or 0%.

Further on Ms Hackborn admits she cannot speak to different devices and how they report battery levels to the OS, she is only talking about the batterystats.bin file and how deleting it is pointless.

Based on the linked article, I will update my OP to omit the file deletion step, because I am sufficiently convinced it is unnecessary.
[Captivate General] Entropy512:
No, it is not possible - I suggest reading the MAX17040 datasheet. There is nothing in the "firmware" that calculates the state of charge, it is all in the fuel gauge IC, and the IC is specifically marketed as being designed so as not to require calibration/learning cycles.

Specifically, from the link above "Unlike traditional fuel gauges, the ModelGauge algorithm eliminates the need for battery relearn cycles and an external current-sense resistor."

The only thing you should do if you think your battery SoC estimate is off is - wait. The fuel gauge is specifically designed to converge towards truth over time (I'm talking hours at most in this case), unlike "coulomb counter" type gauges which can potentially diverge over time.

The one case where the MAX17040 tends to get "thrown off" is a reboot when the battery is low. The battery voltage droops more under load at low states of charge, and the algorithm, as documented in the "IC Power-Up" section of the datasheet downloadable from the link above, states that the IC assumes that the battery has been "relaxed" (no significant load) for the past 30 minutes. As a result, the excessive load of the boot sequence confuses the gauge and reports low.

If this happens, the chip does have a "Quick Start" feature (documented in the quick-start section) which lets it get reset after bootup. Most kernels I've seen don't do this, but there's usually a sysfs interface that allows you to reset the chip.

On the Infuse it was something like:

echo "1" >/sys/class/power_supply/battery/fg_reset_soc

The exact path may be slightly different on the Captivate, and I may be wrong about the exact file name even for Infuse as my memory is a bit fuzzy, but on every Samsung Galaxy S and Galaxy S II device I've seen this is the only input available into the fuel gauge IC. (Exception - Oddball mangled variants with non-Samsung CPUs are total unknowns.)
[Captivate General] joeybear23:
Can you show me where the MAX17040 is used in the Captivate? I am having a hard time finding that info anywhere. I do so where it is mentioned to be in the Galaxy Nexus and the I9000, but nothing on the i897 Captivate...
[Captivate General] Entropy512:
https://github.com/teamhacksung/sam...rm/configs/aries_captivatemtd_defconfig#L1327

Any device that has a Hummingbird has a MAX8998 PMIC - The MAX17040 fuel gauge functionality is built into the MAX8998 PMIC. (I can't find a link for this at the moment - it is in the description of one of Samsung's MAX8998 patches to the mainline Linux kernel.)

The only devices I have ever seen with a Hummingbird CPU that use an alternative method for state of charge estimation are the Galaxy Player 4.0 and 5.0 - These devices do not use ANY fuel gauge IC for state of charge estimate (even though the hardware is there...), and instead calculate it from current battery voltage (translation: inaccurate as hell under any circumstances, and completely independent of any battery history).

Also, all Exynos-based Galaxy S II devices use the MAX8997 PMIC, which has MAX17042 fuel gauge functionality built in. While the 17042 does have some advanced features (including current sensing), these features are not used in any Galaxy S II model I have seen (I9100 variants except the OMAP-based I9100G, I777), and the gauge behaves almost identically to the '40. Don't believe me - read the kernel sources for any I9100 or I777 kernel. https://github.com/Entropy512/linux_kernel_sgh-i777/blob/master/drivers/power/max17042-fuelgauge.c - Note the complete absence of CONFIG_TARGET_LOCALE_NA and CONFIG_TARGET_LOCALE_NAATT defines, which means this driver is compiled identically and hence and behaves identically on both the I9100 and I777. (Just like there is very little difference hardware-wise between I9000 and I897...)
[Captivate General] joeybear23:
Thanks for that.

I do know that with my GSII I have never gone through this because if you run to zero it will not allow you to turn it back on until you plug it in and it has built up a decent charge. Also I never saw any strange battery status issues with the GSII. It has always just worked from day 1.

My Captivate, however, behaved much differently. Every time I would load a new ROM, I would have to do so when it was at 100% and plugged in, otherwise it would report battery percentages that were way off, and it would stop charging even though while it was turned off it would show only 50-75% charged, or it would auto shut off when there was still 20% or more left. And sometimes it would still do it anyway. However, if I went through the process listed in the OP it would resolve the problem every time. I guess, based on the info you provided, those issues may very well have gone away on their own, but in my experience with flashing ROMs on the i897 I would always see sporadic battery info if I did not do the "recalibrating". That also seems to have been the experience of hundreds of others.
[Captivate General] Entropy512:
Flashing a ROM on low battery takes the corner case I mentioned above (Reboot on low battery) to a whole new level of confusing the fuel gauge, since that presents a few minutes of heavy load immediately after a reset while the dalvik cache gets rebuilt, not just 30-60 seconds of heavy load.

If you flash when on external power you should be fine. Or just wait a few hours of use.
[Captivate General] joeybear23:
Well, since I no longer have a Captivate, and can't test any of this, I will defer to your expertise.

I will update the OP with a message at the top, but will leave the rest in case anyone wants historical reference, or finds comfort in the apparent placebo effect.
[Captivate General] tiuk:
Seems like a good place to ask:

I have three batteries for my skyrocket, stock is 1850ma, and i have two 2050ma. When a battery gets low and i shut down and swap for a different capacity, what would happen to the reading? The skyrocket seems to handle it, but i also have a captivate.
[Captivate General] phlunkie:
Flashed my phone 4 out of 5 days. Thinks stats are housed.
[Captivate General] phlunkie:
Phone died. I am plugged in now. Tonight, after this post, I will run the battery died again. I will then charge it over night turned off. Tomorrow I will use the phone the same as I do everyday. Will check in during the day with updates.
[Captivate General] ConceptVBS:
Yours seems like a lemon. I would get a replacement and do what the OP suggested on the first post.
[Captivate General] phlunkie:
Day has started @ 100%.

edit: While I got ready for work, I put the phone back on the charger while powered on to ensure the battery was recognized as 100% charged. I pulled it off at 7:20ish.

I listen to pandora/mixzing through out the day. I surf on breaks. I text. I generally use this phone as a small portable pc. Not a phone.

11:17 @ 84%.
[Captivate General] coldbeverage:
The same thing happened to me. I am going to return mine. Can't hurt. I am also buying a spare battery. They're not expensive!
[Captivate General] PixelPerfect3:
Ok I just tried this technique and nothing happened....battery is bleeding fast. I might try loading my previous ROM again to see if becomes ok again but I doubt it. Might just have to get a new battery.
[Captivate General] joeybear23:
With many many many rom flashes and updates, I am still able to see excellent battery performance. Once or twice I have come across a ROM that has something in it that really drains the battery, but usually it is an application that is doing the draining, not the build.

If you go through this procedure step-by-step each time you flash a new ROM, or just once if you like the ROM you are on and want to keep it, my experience is that battery life is awesome.

With minimal use I have gone almost 48 hours once, and with moderate use I always get through an entire day.

Juice comes off the top (from 100% to 85%) pretty quickly, no matter what I do, however the middle range stabilizes a bit, and the low range (<25%) drains the slowest.

You cannot extrapolate out the time it takes to drop from 100% to 85% and predict your battery dead time. You have to actually get to 0% and let the phone shut itself off in order for the stats to be updated correctly.
[Captivate General] Kitschbot:
A warm thank you

I've been flashing roms left and right on my phone and the battery has been nuts. I'd plug it in at 3% and the read charge on screen would jump to 57% after a minute of charge.

This recalibrating method worked wonders! I finally have my battery life back as if I never messed with the roms. Still, I'll probably be flashing new ones and hopefully I won't have to recalibrate so many times, but it's comforting to know there's a method that works.

Anyway, I really want to thank you for posting this, your clear instructions made my life a little bit easier. I am grateful, even if the Captivate's battery life isn't top notch. :)
[Captivate General] jb1911:
I thought lithium batteries didn't have a memory problem. How can you train a battery that has no memory effect?
[Captivate General] polarbee:
Did some searching and found this:

Although lithium-ion is memory-free in terms of performance deterioration, batteries with fuel gauges exhibit what engineers refer to as "digital memory". Here is the reason: Short discharges with subsequent recharges do not provide the periodic calibration needed to synchronize the fuel gauge with the battery's state-of-charge. A deliberate full discharge and recharge every 30 charges corrects this problem. Letting the battery run down to the cut-off point in the equipment will do this. If ignored, the fuel gauge will become increasingly less accurate. (Read more in 'Choosing the right battery for portable computing', Part Two.)​

From here.
[Captivate General] devho:
Here Ive been trying to complete a full discharge and my battery has been stuck at 3% for the last 45 mins. I played Angry Birds for a good hour, let the camera run... To quote Joaquin Phoenix from Gladiator, it "simply wont... die."
[Captivate General] thefunkie1:
I just did the the whole recalibrate process (minus the deletion of the battery stats file) and I have noticed a difference. My Captivate is relatively new (Rogers) but I went through the process and I am at 50% battery after 24 hours. Before doing the recalibrate I had to charge every night for sure - usually down to 10 - 15% battery by the time I went to bed. So it has made a huge difference so far. I hope it continues.
[Captivate General] joeybear23:
You are not training the battery.actually you are training the phone to read the battery status correctly.

posted with my thumbs in landscape...
[Captivate General] geokilla:
Um, where can I download ADB? Is it the Android SDK and stuff in this thread?
[Captivate General] geokilla:
Ok I ran the following in Terminal Emulator and didn't get a message or anything. So I guess it worked?

su
rm /data/system/batterystats.bin
[Captivate General] veive:
In this case no news is indeed good news.

For anyone trying this procedure I would HIGHLY recommend Bump Charging first, to make sure that you get an actual 100% set in the OS.
[Captivate General] Joel1030:
Not Working

I tried teh sequence in terminal emulator, but this message keeps appearing after i hit enter: NOT FOUND OR rm failed for / , Is a directory

I tried the sequence in a few ways trying to get it to work, but no result at all, and when i say "few ways" i mean like rm / data/.... or rm/data/... or rm/ data/... just changing the space between the RM and the Data...

Any help???
[Captivate General] skinien:
Is removing: rm /data/system/batterystats.bin

the same as wiping battery stats in Clockwork Recovery?
[Captivate General] Eschmacher:
Awesome. Going to try this today. I've had at least 6-8 hours less battery since i went to the unofficial release of 2.2 for the captivate...
[Captivate General] joeybear23:
yes it is

:)
[Captivate General] joeybear23:
the first time you run it, it will succeed and give no message.

If you try a second time, the file does not exist so it will give an error.
[Captivate General] geokilla:
That's good to hear, but I think I'll have to try bump charging now. I thought I calibrated the battery properly according to the thread here, but I'm not so sure if it worked or not. Battery life is more or less the same since I used the phone less over the weekend. Today I started off with 30% battery and I had to charge the battery TWICE via USB. Of course charging USB is slow, and the fact that the mini-USB kept on popping out of the Captivate didn't help either.

Well when I got to 10% battery life left when I left school, the percentage was going down pretty quickly. I had 1% when I got home and that lasted me a good 15 minutes, whereas it dropped from 10% to 2% in 40 minutes. There was no service and I wasn't listening to anything either since Media Player doesn't start if your battery is low. The phone finally died just now so I plugged it into the wall to charge it and I turn it on. Wth? 14% battery life already?! Sounds like I have to recalibrate it again.
[Captivate General] eep2378:
Ever since flashing the latest cog rom my battery life has been poor at best. I've done the calibration twice with little effect. I'll have to try bump charging.

I've taken most of precautions regarding longer battery life. I have a flat black wallpaper, background data off, brightness 0. After 7 hours of moderate use, wifi, a few apps, browsed the market for a little, a couple voice calls very short, I'm down to 54%. Now the other weird thing I noticed is in my bat stats display accounts for 90% of usage??? With a black wallpaper??really? ?

Sent from my SAMSUNG-SGH-I897
[Captivate General] Rizz67:
I just wanted to share my experience with the Bump Reset. I was getting MAX 8-9 Hrs a day on my battery life. It was doing nothing but sitting on my desk at work. I was losing around 10-15% an hr. This was ridiculous, for i always needed a charger next to me. I have since done the Bump Reset, battery life has been a DRAMATIC difference. As we speak, the phone has been on for 9 hrs. It has only used 32%. Do the math and that's only 3.5% per hour. Perhaps other people are getting better results, but this was huge for me. I bought the phone the day it came out. I think from now on i will wait on being an early adopter. Not going to go into great detail, but Battery Life, GPS, Screen Hue, and LAG LAG LAG differences compared to my buddy at work who bought it last week.
[Captivate General] geokilla:
Bump charged and deleted batterystats.bin again last night and this morning. This is my 2nd and final time calibrating the battery hopefully. My battery life doesn't seem to have changed much after all, and I'm actually losing my charge quicker. So far with moderate usage and total 7.5 hours of uptime, I got 41% battery left. My Android System is pretty high in the hidden menu page. Maybe I have a bad battery? Or I need to do hard reset? I'm going to report back tonight. This is what I did on the phone so far:

2 hours of music and internet radio

10 minutes of web browsing

texts

1-minute call

update apps with AppBrain

You're supposed to drain the battery then charge it overnight the first day you got it correct? Cus I didn't do that... I plugged it into the computer a couple times to transfer my music before charging it overnight using the wall charger.
[Captivate General] geokilla:
What terrible battery life... Phone died just right after I unplugged it from the computer.

I can't figure out why Running is so freaken high... I have sync and GPS disabled like I mentioned in my earlier posts elsewhere. I think I need to hard reset...
[Captivate General] MrLemon:
It works!

Um WOW! Why does this work?

Before this tweak, I got about 12 hours of use, from FULL charge to SHUTTING OFF. It was like this since I got the unit.

After the tweak, I am at 24 hours and still have 70% of the battery left. I plan on running it today without a recharge to see how far it goes.

Yes, my usage was less then the previous days, but before the tweak, the battery would just drain away on its own. Now, I left it on overnight and lost 4% of the battery, which is AWESOME.

If this did not work, I would have sold the Samsung Captivate and tried an HTC Desire. The captivate is a nice handset, but if i have to worry about charging it during the day, it isn't work it.

Thanks!!

TOM...
[Captivate General] ck9035:
OH !! I have to try this ASAP
[Captivate General] zeamany:
Thank you for your great information on this issue, Joey.

I have read through your posts (and some others), and decided to give my cappy a try.

Before I did this, I tried the bump-charge as well. However, after I drained my battery (phone off automatically, and plugged the power and turned on the phone immediately, the gauge said it was at 43%. It can't be true that during the boot-up, the battery has been charge to 43%!!

Does this mean my battery or/and OS forgot where the 0% was, and how should I make them to remember the true 0%?
[Captivate General] mrjazze:
I gave your suggestion a try yesterday and to my surprise today I was able to watch a 1hr 30m movie and listen to music for two hours and the battery still showed 73% charged; AMAZING!!! Given I couldn't get through 30-45 mins of poker and see about 50% battery life.

I'm sure SAMSUNG/ATT are monitoring this site, why don't you all push out these fixes for your products?

Thanks, Joey.
[Captivate General] joeybear23:
If you have Clockwork installed on your phone, turn the phone off and let it charge until the screen shows 100% (you can press one of the volume buttons to see it's progress).

Instead of turning on the phone when it hits 100, go into clockwork recovery (three-button combo method) and go through the menu to the "clear battery stats" option. then reboot.

See if that helps at all.
[Captivate General] blackdragoon:
Thanks for the info!

This greatly improved my battery life.

Unfortunately, it only improves it for the single charge that I do this for.

Subsequent charges have given me horrible battery life (ie. complete drain within 16-20 hours).

But every time I follow these steps, my phone will last me about 50 hours on that single charge.
[Captivate General] joeybear23:
It sounds to me like there are some processes that are draining it.

Please take a look at this thread by TheYar for some pointers on eliminating battery drain:

http://xdaforums.com/showthread.php?t=806211
[Captivate General] Kagoshema:
wierd thing happened to me, i went through after flashing a new rom, and after fully discharging, i turned the phone back on and plugged it in. 5 min later it said 40% battery

glitch?
[Captivate General] joeybear23:
I have seen that before. I don't know if it is a problem with the battery stats or something else, but if you unplug right after that happens and use it, it will die much quicker than if it really had 40%

Warning: posted with Swype...
[Captivate General] joeybear23:
I edited the OP to add:

I think a lot of the battery issues stem from the modem searching off network.

If you look at your battery usage, most often you will see twice as much time recorded as it has actually been on, and 50% time without signal.

The only way I have found to keep that from happening is to put the phone in flight mode for a moment or two after every reboot.
[Captivate General] The_Zodiac:
the problem that im having is when i unplug the phone my battery instantly says 99%

i tried using this method and clearing the battery stats but this stil happens

edit: okay i was able to finally get it to say 100% buy waiting till it said fully charged, unpluggin, waiting for it to say charged, then doing it again

question is, should i clear the battery stats now?
[Captivate General] xThe Enforcer:
Right now my battery life is 'okay' but I'm sure I'll eventually have to try this.
[Captivate General] zeamany:
I have ROM manager installed. When i enter clockwork recovery page using three button combo method, i could not see a line called clean battery stats.
[Captivate General] joeybear23:
It should be under the "advanced CWM options"

I would clear the stats when you hit 100%, yes.

However, if you are running a 2.2.1 ROM, you will not be able to normally charge past about 98% because of some new battery overcharge protection stuff. It will show 100%, but drop to 98 immediately after unplugging, which really is no big deal, but some people like to see the "100%" up there.
[Captivate General] Ikonomi:
This is very similar to my situation. I'm currently sitting at 95% battery usage for display. On stock, even when using the screen a LOT (like constant web surfing, Facebooking, whatever), the display wouldn't get above 75%. And that's constant screen use.

I've been unplugged for 48 minutes, and the battery is down to 80%. I've bump-charge-calibrated twice using CWM to delete battery stats, but the behavior seems the same. Not really sure what to do. I guess it's something with Cognition 2.3b8, but most other people are getting great battery life with it.

Not sure.
[Captivate General] Sleeping Giant:
Was experiencing horrible battery life after messing around with some custom ROMs, this fix worked like a charm. Thanks a lot.