Email app battery drain - FIXED - HD2 Android Q&A, Help & Troubleshooting and Genera

Everyone,
just thought I would share this with you. I had discovered a problem in the native Email app with Exchange ActiveSync account. If a connection was lost a battery drain occurred which did not stop unless you killed the service, restarted your phone or put the connection back (a partial wake lock was not released in the sync service).
http://code.google.com/p/android/issues/detail?id=9307
I have been in discussions with Google developers about this for a long time and they were not able to find or track down the bug. I managed then to compile the Email app myself, debug it, find the problem and fix it.
Google finally confirmed the bug...
You can see the symptoms explained in post #77.
At the end of the issue you can see my analysis and how the code was fixed.
Anyway, find the latest Email app below so you can download it.
The Email app version is 2.3.5r1 (latest Git repository version of Gingerbread 2.3.5r1)
The changes done
- Fixed battery drain (wake lock released properly)
- Calendar synchronization syncs all historic events (not only 14 days old and newer)
Installation notes
Since Email app is a system application you cannot just install it and replace the old one. The only way is to have a rooted phone and delete the old /system/app/email.apk (make a backup of course).
Reboot your phone and then install the new Email.apk. It is suggested to remove the accounts first otherwise you can get a FC.

That's great work Jacob!
This bug should exist on all gingerbread roms, no?

Should I just installed it or replace the original one with root explorer?

Can not synchronize ALL messages, maximum period is month!

tommy1971 said:
Should I just installed it or replace the original one with root explorer?
Click to expand...
Click to collapse
I have just updated the installation notes. This could work too but since I was constantly updating and testing the app I decided to make it a user app by the steps in the first post.

Denkov said:
Can not synchronize ALL messages, maximum period is month!
Click to expand...
Click to collapse
Yes, a standard behavior of the Email app. I could bypass that too if you need. It's a shame that both Calendar and Email period of sync cannot be setup properly (whatever the user might desire)

Great news, thank you very much!!!
Will definitely test this evening .
Yes, ability to sync all mail would be nice, too, if it's not a problem for you .

This is great, good job.
I experimented the same issue and noone seemed to believe me. Well done.
EDIT: btw im a galaxy s cyanogen mod user, maybe you could post this in a more general forum

I'm not knowledgeable about these things, but how would someone go about getting this fix implemented into CM7? I'm also a Galaxy S CM7 user who has suffered from this issue and I've had to resort to using Moxier Mail as a remedy. If I install this fixed .apk, will it just get overwritten once I flash the next CM7 nightly? It would be great if it could be integrated into CM7.

Works very well on Samsung GalaxyS-CM7, thanks a lot!
One question though, the maximum sync period is one month, whereas in the CM7 client it can be set to unlimited (for email at least).
I also made a zip-file to flash this new email.apk. Made for galaxy S CM7, but I guess it should work on any CM7...

3h ago exchanged Email.apk and so far good. Switching to Flight produces 2mA drain. Synchronizing corporate mail and Contacts/Calendar works normally with no issues so far .

niiiiiceeeeee!!!!
but is there any way to get the app skaled when changing the devices-density???
it's been workin' with this one:
http://forum.xda-developers.com/showthread.php?t=775007
but your version keeps beein small while changin
thx in advance...

Hi jakubklos,
I'm using airplain mode every night when I go to sleep and being aware of this annoying bug I usually kills the EMail app and stops all it syncs.
From now I can go to sleep knowing I won't be losing 10% or more of my battery while sleeping.
You're great man!
BTW, Beats me what takes Google so much time to fix it themselves.

genius, thanks jakubklos

Is this the same email app for sense roms or is it only ASOP that is effected by this issue?
Also, Way to go on showing google up!

cant use it ..i get force close all the time !!!!!

mootmetal said:
cant use it ..i get force close all the time !!!!!
Click to expand...
Click to collapse
I got that too after installing it, but then I fixed the permissions using Rom Manager and rebooted and it worked.

If I am using the Gmail app, can't I just uninstall the system app and not worry about installing the new one?

Revhead said:
If I am using the Gmail app, can't I just uninstall the system app and not worry about installing the new one?
Click to expand...
Click to collapse
Yes, you can do that.
Just to update, left the phone over night on flight mode and there was no battery drain.
Great work!
Sent from my GT-I9000 using Tapatalk

Thanks a lot for this!

Related

Facebook 1.3.0 Update is Bugged - Update from Developer

From the thread on the Android Apps Forum discussing the battery drain:
http://forum.xda-developers.com/showthread.php?t=744974
davidalves said:
Hi folks,
I'm a developer at Facebook on the Android team. First off, thanks for bringing this to our attention. We have identified the bug that is causing this battery drain and are working on a fix now. As soon as the patch is ready, we'll push out an update. Thanks for the quick feedback and for your patience as we get this fixed!
Thanks,
David
Click to expand...
Click to collapse
He only has 1 post, so he hasn't posted this elsewhere. Thought others would be interested in seeing this.
Ahh, good to know that official..
Good news. Looks like the fix is out version 1.3.1
I just downloaded it. Hopefully I'll have better battery life tomorrow.
Holy crap. Is that what is happening to my battery the last few days. ..
My battery had been exceptionally terrible the last 2 days as well
Noticed version 1.3.1 is out now
Update and save those batteries
I had backed up my last copy of FB. Now that the developers noticed the issue and released and update, so will I. Coo'
This may be an obvious answer, but how do we update the facebook app that's installed with the os?
samagon said:
This may be an obvious answer, but how do we update the facebook app that's installed with the os?
Click to expand...
Click to collapse
Market
New update is still sucking my battery. Anyone got a link to the old version?
Edit: nevermind, you can just uninstall the updates by doing it in the market.
I wonder why some people have this problem and others don't. My friends sees the problem on his Incredible, but I don't see any drain on my N1.
GldRush98 said:
I wonder why some people have this problem and others don't. My friends sees the problem on his Incredible, but I don't see any drain on my N1.
Click to expand...
Click to collapse
Do you have the widget on the home screen? Otherwise check about phone, battery info, what's been using the battery and if android os is real high, then Facebook is probably preventing the phone from sleeping.
GldRush98 said:
I wonder why some people have this problem and others don't. My friends sees the problem on his Incredible, but I don't see any drain on my N1.
Click to expand...
Click to collapse
Your friend has more friends and hence more activity.
nelsonHa-Ha.jpg
I havent had any problems with the new update, but then again, my facebook 'sync' options have never been enabled. I think today facebook updated itself again
I don't do anything with Facebook, but I do have the updated app installed and logged in. About 30 friends, sync with contacts, and no battery drain at all. System panel shows only 5 seconds of CPU time used over the last 8 hours.
Well I skipped Facebook 1.3.0 and 1.3.1 because of the battery drain. Today installed 1.3.2 and in 53 minutes the Facebook app was good for 50 minutes of partial wake time.
(and this is with update notifications set to never, etc.)
Uninstalled....reverted back to 1.2 and now no more partial wake usage from the app!
Having installed 1.3.2 my partial wake time is only 14s since unplugged for Facebook. I've got it set to notify me for messages and friend requests, plus it syncs contacts already in the phone. That said never had issues on 1.3.1.
Does anyone has the version 1.2 apk saved somewhere ? I'm looking for it and I can't desinstall the updates unfortunately.
Thank you in advance!
Any hosting service would do the trick
I haven't had a single problem in a week out of Facebook, in fact only the first day of using 1.3.1.

Exgange Push - Battery Drain

I have read a number of posts where some are experiencing severe drain like me and others that are not. I have tried KE2, KG3, KG6 and now KG5 all have been the same as soon as push is enabled on my work email exchange account with the stock email app, there is an immediate drop in the battery graph and the phone heats up, with the awake time showing as almost constant even when screen is off.
This drains my battery at around 10%/hr whereas with sync set to manual, I am only getting a drain of up to 1%/hr. Problem is I want to use push!
So, anyone who is not experiencing this - what is the trick?
Or will we see this addrerssed at all, but so far loads of updated firmware and still this problem exists with me.
You can't have everything at a time dude. Give up good back up if you need Push, or give up push to have the opposite
I'm having the same issue. Give up the Push? Come on now. As far as i understand we paid big bucks for this phone and want all the features to work properly. This is stock option and a must for everyone, how good is the phone when you cant have push email in this day and age. This is first android (SGS2) i'm having 2nd thoughts about samsung.
babamike said:
I'm having the same issue. Give up the Push? Come on now. As far as i understand we paid big bucks for this phone and want all the features to work properly. This is stock option and a must for everyone, how good is the phone when you cant have push email in this day and age. This is first android (SGS2) i'm having 2nd thoughts about samsung.
Click to expand...
Click to collapse
Nothing is must for everyone. And if you really need Push this days then you better start preparing yourself charge the device everyday. Having Push email is a Smart stuff, same goes for Charging
Regards.
I wish there was a way to enable automated refresh every x number of minutes, like the iphone.
Sent from my GT-I9100 using XDA App
ithehappy said:
You can't have everything at a time dude. Give up good back up if you need Push, or give up push to have the opposite
Click to expand...
Click to collapse
Sorry, but that's completely false.
I have exchange sync on PUSH and gmail on PUSH. Always had it on push, since my Nexus One.
Battery drain is very very minimal.
For example with my SGS2 running Cognition 1.31 I just got around almost 40 hours with light use. That's with Bluetooth and Wifi on for most of that time.
If your email push is eating the battery... try to reinstall the Email.apk to one of the other ones floating around here (for example I use one from 2.3.4 with exchange security bypassed). No battery drain that I'd ever notice, and I get decent amount of emails through the day.
Remember that you have to reinstall by deleting/replacing Email.apk in system/apps (need root).
I've always hated the stock email client. Pony up for Moxier Mail. You'll definitely be glad you did. I have push scheduled for 10hours a day and I drop 2-3% an hour. An hour after I get off work it switches to manual poll. Also limit the number of folders you're pushing if that's possible in the mail app.
linkin85 said:
I wish there was a way to enable automated refresh every x number of minutes, like the iphone.
Sent from my GT-I9100 using XDA App
Click to expand...
Click to collapse
Yes you can. Set your off-peak hours to all hours in the day, and set it to check every <...> hours/minutes.
linkin85 said:
I wish there was a way to enable automated refresh every x number of minutes, like the iphone.
Sent from my GT-I9100 using XDA App
Click to expand...
Click to collapse
There is on the stock email app but not on the GMail one as far as I know. Even the timed sync seems to be causing me issues though. Very disappointed in this aspect.
Edit: DarkDvr beat me to it.
AeronK said:
There is on the stock email app but not on the GMail one as far as I know. Even the timed sync seems to be causing me issues though. Very disappointed in this aspect.
Edit: DarkDvr beat me to it.
Click to expand...
Click to collapse
Dude, seriously, try to root/delete Email.apk.
Get one of the other versions from xda, install that one.
Reboot, see if it works.
If nothing helps, just install Cognition.
DarkDvr said:
Dude, seriously, try to root/delete Email.apk.
Get one of the other versions from xda, install that one.
Reboot, see if it works.
If nothing helps, just install Cognition.
Click to expand...
Click to collapse
I may try that then - havent come across the email.apk but then again havent tried searching yet. Is there a guide on how to replace the apk after rooting (need to do that as well, but already researched that)
Thanks for the advice.
Experiencing same problems as OP!
Have had a bunch of Android phones, and no other has this problem.
I've tried Stock mail, patched stock mail, patched AOSP mail and Enhanced Email.. They all give too much wakelock. Use BetterBatteryStats (charmonix) to catch your wakelocks.

Battery drain - source found

I have had problems with battery drain on my S2 from the day I bought it. The battery would last apprx 12-14 hours before going dead - almost without use.
I then removed an Exchange (ActiveSync) mail account. And the problem was gone. 30+ hours battery with no problems. I added the mail account back, and the problem reoccured. I testet this some more times and it was consistent each time. BTW I was not using push, just manual mail update.
The mail account that I am adding forces encryption on the phone, so it might be that this is the actual source of the battery drain. But it shows that the phone is useless using ActiveSync with encryption.
I was hoping that this was fixed in 2.3.4, but the problem was the same there as well. Until this is fixed (which I don't suspect will happen) I can not use the phone with my job email account because of this.
Yes you can go to themes and apps section and search for the administration removed email app, stock app with the corporate control removed try it and see if that works better, currently using it myself and no big battery drains.
Sent from my GT-I9100 using XDA App
"go to themes and apps section and search for the administration removed email app, stock app with the corporate control removed"
Where is this? Android Market? I did not find it...
Themes and apps section of this s2 forum
Using 'Push' uses a lot of battery. See if you can manage with 'Manual' or scheduled to check every few minutes.
Also disable 'Auto-sync' if not required.
Log out of Latitude from within Maps.
anisbombaywala said:
Using 'Push' uses a lot of battery. See if you can manage with 'Manual' or scheduled to check every few minutes.
Also disable 'Auto-sync' if not required.
Log out of Latitude from within Maps.
Click to expand...
Click to collapse
As I said in my initial post - I do not use push - I have everything on manual. It drains battery even if I do not check the mail once.
jr866gooner: I found it, but I guess this forces rooting of the phone? It is a phone owned by my employeer, so this is unfortunately not an option :-(
steinrr said:
jr866gooner: I found it, but I guess this forces rooting of the phone? It is a phone owned by my employeer, so this is unfortunately not an option :-(
Click to expand...
Click to collapse
You can unroot upon return just use a insecure kernel which will bypass superuser I think.
Sent from my GT-I9100 using XDA App
I also pinned down my huge battery drain (10% per hour) to the Exchange email connection I use. I have tried various stock ROMs and some custom ones, but all seem to give the same result. I must say that older ROMs did not seem to have the drain this much. I am currently running Cognition 1.5.1.
Currently I work around the drain by manually syncing my email whenever I want to read email and this results in a whole lot less battery consumption (I now have 50-70% battery left with moderate use, instead of only barely managing 8 hours or so.
I have installed the modified Email.apk to see if this fixes some issues. The email.apk in Cognition did not have a .odex file anymore and was a few bytes different in size, so I really really hope that this fixes the drain. I'll keep you posted.
Gerco
Would someone please be so kind to link the thread with the modified apk? Forum search through tapatalk is not always an easy task
Thanks a lot guys
Inviato dal mio GT-I9100
I wasn't sure either, but I used the info in this link:
http://forum.xda-developers.com/showthread.php?t=1117452&referrerid=1505433
gschot said:
I wasn't sure either, but I used the info in this link:
http://forum.xda-developers.com/showthread.php?t=1117452&referrerid=1505433
Click to expand...
Click to collapse
Its not this one, similar thing the other one uses a different method, will try to find the link for you all.
Sent from my GT-I9100 using XDA App
hey how about if i use another email app? will that bypass the problem?
aeonstorm said:
hey how about if i use another email app? will that bypass the problem?
Click to expand...
Click to collapse
You can try the stock asop one from dark knight thread, think check fixed the wakelock issues, very similar to the Samsung version minus a number of features but based on the same source.
Sent from my GT-I9100 using XDA App
I guess you guys mean this link?
With kind regards,
patpeewee
My test results with the email.apk I had found did not really show improvement of battery usage, so I am very curious for the link that nikzDHD means. Is this the one patpeewee mentions? I did not see any remarks about wake lock issues in the op.

[BUG] in Kwiboo 's ICS v2

Many thanks to Kwiboo first for making a mostly daily ICS rom.
I flashed it last night and would like to talk about some bugs.
1. "android.process.acore" error
It comes frequently after using a third part Contacts Sync App.
That is to say, only System Account Sync is OK to avoid this error.
2. Apps bugs
a. "root explorer" UI error.
b. "QQ" force quit.
Other function is still tested, but so far so good.
I can't wait any longer for the next more perfect version.
Come on Kwiboo !
ICS from Kwiboo is really nice enough to be a daily ICS rom.
Posting here to say thanks to kwiboo! ****ty 10 post to write in dev section! xD
And with franco kernel it's awesome!
Anyway to get rid of the flashing screen on lock?
I noticed Google Wallet won't work. It says something about insufficient privileges. Which sucks because I actually use Google Wallet.
Nevermind about the flashing screen. It disappeared after flashing the new version of the kernel! : )
damn it
have to post 10 posts before starting a thread... i am not gonnaa forget my account again,<3 android, was, is, always
haha, actually same purpose for me, no bug like flashing screen on lock wor, just use the whole rom from Kwiboo.
yongxian said:
Many thanks to Kwiboo first for making a mostly daily ICS rom.
I flashed it last night and would like to talk about some bugs.
1. "android.process.acore" error
It comes frequently after using a third part Contacts Sync App.
That is to say, only System Account Sync is OK to avoid this error.
2. Apps bugs
a. "root explorer" UI error.
b. "QQ" force quit.
Other function is still tested, but so far so good.
I can't wait any longer for the next more perfect version.
Come on Kwiboo !
ICS from Kwiboo is really nice enough to be a daily ICS rom.
Click to expand...
Click to collapse
To get rid of the Root Explorer issue:
- Download 'Spare Parts' from the market
- In Spare Parts, uncheck 'Compatibility Mode'
- Reboot
Hmm.. I dont have that root explorer problem
Sent from my Nexus S using Tapatalk
MistaJae said:
To get rid of the Root Explorer issue:
- Download 'Spare Parts' from the market
- In Spare Parts, uncheck 'Compatibility Mode'
- Reboot
Click to expand...
Click to collapse
Works fine, Thanks !
Tweetcaster pro looks like the tab version
Sent from my Nexus S 4G using Tapatalk
when is the v3, eeee
I noticed that GoSMS is unable to load my contacts, just shows phones #'s. I assume it's due to GoSMS not being ICS compatible?
I also signed up to say thanks for this So if you read this kwiboo.. thanks
I have a NexusS i9020XXKD1 (Wind/Tmo)
I am running kwiboo's v2
patched with Franco (No OC)
For the most part everything works, I have found these problems.
In addition to kwiboo's issues
Not working at this time:
Enhanced Email app (FC, Based on GB Email app, needs to update)
Viber app (FC)
VPN PPTP (Doesn't connect, worked fine in 2.3.7)
Google Wallet v5 Patch (FC)
Occasional Lockups (1-2x a day, attribute to Franco's kernel, if I had to guess)
Go SMS works alright, but your contacts are deleted in the flashing process, no Google services yet, no market but will be fixed in near future (I hope)
Sent from my Nexus S using xda premium
im still using we scream for ics beta7 now...whats new for kwiboo's ics?
Sent from my Nexus S using XDA App
I'm quite happy.
Exchange Calendar isn't syncing..
Camcorder won't record
Browser behavior is at times wonky where it zooms all over.
It seems to get steadily better.
erikkWTF said:
I noticed Google Wallet won't work. It says something about insufficient privileges. Which sucks because I actually use Google Wallet.
Click to expand...
Click to collapse
i have google wallet working fine on my device. try the steps that i took to get it working
http://forum.xda-developers.com/showpost.php?p=19609557&postcount=2515
sean_engadget said:
I'm quite happy.
Exchange Calendar isn't syncing..
Camcorder won't record
Browser behavior is at times wonky where it zooms all over.
It seems to get steadily better.
Click to expand...
Click to collapse
try a different kernel
surveysays said:
i have google wallet working fine on my device. try the steps that i took to get it working
http://forum.xda-developers.com/showpost.php?p=19609557&postcount=2515
Click to expand...
Click to collapse
Awesome, glad to see wallet is working for you. Although, I feel like formatting data is drastic (for me at least). I'm gonna try flashing venumx's walletfix (v5).. I'd link it but xda's ns4g threads are all f'd right now. seriously mods?

[RC]Fbook: Full sync working - will have pics up later tonight!

I will be uploading my rom very shortly. I believe this is the right section, I am not a dev yet....but the devs have said that ICS can't synch facebook from what I have heard and that it requires Haxsynch to work.
I don't have my contacts setup perfectly at the moment so I haven't got it to synch contacts properply, but so far it has synched something, it has synched all Calendar from facebook and messages and it is opperating the facebook interface within Android like on any other samsung phone
Can someone tell me a decent screen capture app for SGS running Ice Cream Sandwich 4.0.3 RC 3.0?
I also have all SNS accounts work, Twitter, Alternate email and even Server
Will be testing and adding up results soon. It's late here in Australia and I am preparing my ROM of ICS to be ready for Uploading here.
Thanks,
James
Interesting... You used romanbb's fix?
Btw ICS comes with screenshot capability iirc?
Screenshot.
volume down and power button press
Who is romanbb?
I am sort of new here:
Here is the details of my ROM
http://forum.xda-developers.com/showthread.php?p=21463927#post21463927
Do you have to be an approved dev to a ROM in this section?
I have my thread up in general thats all
just a quick add to bump this cause I know I am very close now. Has anyone been able to get this to work? I have actually got full facebook profiles showing up in my contacts list along with all the details, phone numbers emails etc, the last thing remaining is the picture? anyone further ahead than this?
Facebook sync is working. Didn't realise that I had it going all along? All that was wrong was the permissions on the init.d script? You would think that the "fix permissions" command would actually work however it does not. I used Android Commander to change it cause it was blatantly obvious that it was wrong when the file icon looks different. Will have to give big thanks to the dev of android commander just for this alone
Thanks dude. Works like charm
Sent from my GT-I9000 using xda premium
mnazrin91 said:
Thanks dude. Works like charm
Sent from my GT-I9000 using xda premium
Click to expand...
Click to collapse
Are you serious? I think I pulled those links to my first revision of the ROM. I havent even uploaded the fix for the sync issues yet lol. But I did do a complete pull of my system (systemdump) cause I had ran out of spaceā€¦.somehow removing apps didn't allow for more room? I would pull an app and couldn't put it back. I even pulled like 6 apps and then still couldn't put back the framework, so rather than reboot I just did a system dump and then dragged the 20mb of .so files that I added to try get facebook sync and several other things working and sure enough FB syn stopped working, but allowed me to put my framework back and get my phone online again. That being said I added back what .so files could have been needed and still no sync? Hmmm that means there is an .so file that I bet no one has even considered being necessary and it IT IS!
I now have to play a game of trial and error till I find out which one it is. I am contemplating restoring my system before system dump and then pulling a whole **** tin of apps that I would normally like or need and then keeping sync and then one by one pull files from libs directory until FB sync stops working. Then re-add all the apps I want back up to stock. That will give me a clean ROM to work with.

Categories

Resources