[Samsung Galaxy Nexus] jangutter:
Interested in solving a real puzzler? Then read on!

The patient: a rooted, otherwise stock Jelly Bean (JRO03C 4.1.1) Galaxy Nexus. Being used as an everyday phone (and a bit of development).

The symptoms: Excessive battery drain by "Google Services", but ONLY on my home Wifi network!

This is where things get weird: on 3G, on my company's work Wifi, and without network, the battery drain is absent. I can *reliably* cause Google Services to start hammering the wakelocks, and stop them, just by moving to a different Wifi hotspot. There's NO change in functionality: Google Talk, Play Store, and network access work exactly the same. Push messages seem to come in normally too, but I haven't tested that very well. There's no configuration change whatsoever.

More details: After installing BetterBatteryStats, I've gotten a better look at the wakelock draining the battery. After gathering stats for 25-30 minutes, the following wakelock is the top user:

GTALK_ASYNC_CONN_com.google.android.gsf.gtalkservice.AndroidEndpoint (Google Services): 7 m 47 s (467 s) Count:786 30.3%

So, I decided to check logcat for "GTalkService" messages, and see if there's a major difference between work (good) and home (bad).

Turns out I get a lot of the following at home, but not at work:

[ 08-15 17:36:02.719 709: 709 I/GTalkService/c ]
[AndroidEndpoint@1102186120] connect: acct=1000000, state=CONNECTING

[ 08-15 17:36:34.461 709: 1177 E/GTalkService ]
connectionClosed: no XMPPConnection - That's strange!

This is repeated a LOT and looks like it correlates quite well with the wakelock.

I use the phone, and I would hate to wipe it completely: I would really like to get to the bottom of this.

First of all, I'm not 100% sure this is a Galaxy Nexus only problem. It might be Jelly Bean, or ICS, or whatever. Would you suggest I post on the Google Android bug list, where the crickets chirp, and major bugs disappear into a big Python black hole?

Thanks guys! If only for reading this far!

Update 2012-10-02:

OK, I have eliminated my firewall from the equation: obviously I can't necessarily just whack the work's firewall without consequences. Nothing's blocked, and all services on the phone seem to work.

As for other devices: I dug up my old Nexus One (Gingerbread, stock), and upgraded my Transformer Prime to Jelly Bean. Both do not show the error in logcat, and neither have the battery drain issue. Just for kicks, I checked the version of the Google Services Framework on all three:

Samsung Galaxy Nexus: 4.1.1-398337

ASUS Transformer Prime: 4.1.1-438695

HTC Nexus One: 2.3.6

Wanna bet there's a bug in 4.1.1-398337 that got fixed in 4.1.1-438695?

Further update:

I also tried the following with no success:

Delete app data for Google Services Framework (NOT RECOMMENDED!)

Remove Google accounts from the phone.

Re-add Google accounts to the phone.

Update: 2012-10-04

I think I found a workaround. It looks like it's a domino effect thingy that happens here:

1) I've got a Netgear N600 ADSL/Wifi router at home. On my 2.4GHz radio, I set up two access points: one for my stuff and one for guests. I made sure to delete the guest account from all my Wifi equipment to make sure there's no "fighting" or "flapping".

2) It appears that the phone ignores the Wifi-'stay connected while sleeping' setting, or the radio is broken. When the phone goes to sleep, it disconnects from Wifi.

3) When the phone disconnects from wifi, the Google Services Framework lose connection: this causes the phone to wake up.

4) When the phone wakes up, Wifi gets re-established. This makes Google re-connect.

5) The phone goes back to sleep and we return to step #2.

This causes a LOT of wakeups, lost connections and other crap. Since the phone doesn't lose connection when it's awake, it's fricken difficult to debug. Also, it's NOT a signal quality issue. My phone can be right next to the access point and it wouldn't help.

So, could you guys try different access point settings at home? I've heard WMM, QoS and some of the protocols could cause the Galaxy Nexus's radio in Jelly Bean to go a bit wonky.

-- Jan Gutter