Google Services Framework vs your smartphone battery in China

  • 5 replies
  • 8534 views
At this point, I'm not entirely sure why I still have Google on my phone, but I do. Access to the Play Store is useful for app updates - I'd have to sideload otherwise, and that's increasingly risky - and everybody has to sync calendars and contacts somewhere, right? So anyway, I have a Google account on my phone and Google Play, and therefore Google Services Framework. That sneaky Framework is required by several Google apps, and in Android 5, if you don't replace the Google apps, it's needed for SMS and even for viewing damn photos. Problem is, Google Services Framework isn't really an app or service so much as it's a needy commercial mouthhole on your phone. It updates itself. It keeps in contact with Google. And it wakelocks your phone when it can't. Which for me in China on Android 5.1 means an extra 2 to 4 hours per day the phone is awake and doing nothing but burning battery. And that's not 2-4 hours less normal battery time, nosiree. It winds up being way more. Luckily, I've discovered you can stop it. So, caution, turn back now, here be dragons.

What I find these days when I check my battery stats is a peculiar wakelock associated with a thing called Google Checkin Service. Briefly, a "wakelock" is a situation where some Android process or service for whatever reason does not terminate in a timely manner and is still there doing things while the screen is off. Intuitively, when the screen is off, the phone is asleep, but in the case of a wakelock, nope, it's not - some behind-the-scenes process is still boiling away waiting for some release that never comes. (Wifi routers are a big source of these in Android Lollipop.) And it would seem Google Checkin Service has an especially hard time in China because, well duh, it can't check in with Google. This isn't unique to China, but it seems to happen here a lot. A normal process might time out or give up, but in the case of Checkin Service, either it's too close to Google's commercial heart and they don't want it to stop even if it can't find a connection or the Great FUBAR Wall of China doesn't block so much as delay connection, meaning the service keeps trying and trying to connect just like any normal user sitting at the browser watching the wheels spin. Either way, the Checkin Service is part of Google Services Framework and no direct granular control is available at the user interface - you either disable all of the Framework or you accept the wakelock. Or you screw around with the innards of your phone's operating system. Woohoo!

How to turn off: Check In Service, Config Fetch Service, and Event Log Service (c/o the MIUI Device Team)

You'll need root access to your operating system, Busybox installed, and you'll need some autorun/autostart manager. I use Autostarts, but there are also such apps as Autorun Manager. (NB: you may need the Pro versions, since sometimes the free versions limit the number of autostarts you can alter.) So, you install your autorun manager and start it going. You'll need to get into the settings to make sure it shows System apps. And probably at that point you're good to go. (If you choose to use Autorun Manager and want to be sure what settings to set, you can take a look at the page I found these tips on in the first place.) Good to go means you should find, and disable, the following automatically starting processes:

-         com.google.android.gms.checkin.EventLogService$Receiver
-         com.google.android.gms.checkin.CheckinService$TriggerReceiver
-         com.google.android.gms.checkin.CheckinService$Receiver
-         com.google.android.gms.checkin.CheckinService$ImposeReceiver
-         com.google.android.gms.checkin.CheckinService$ActiveReceiver
-         com.google.android.gms.config.ConfigFetchService$PackageReceiver
-         com.google.android.gms.checkin.CheckinService$SecretCodeReceiver

Finding the processes is as simple as entering their names on the search bar within your autorun manager. Disabling is a matter of tapping the entry and going through whatever process appears - normally a list of options, including "Disable".

Now, I said there were dragons. Those processes are low level receivers associated with system apps, and there're not a lot of people who know what that means. I certainly am not one of them. I have a vague idea of what a low level system process is, but what those ones actually do... well they do something with Checkin, Fetch, and Event Log, obviously. But turning them off does what for the system as a whole? Beats me. But since turning them off, no more Checkin Services Wakelock. I'm still waiting to see if anything explodes. If nothing does, the absence of that wakelock means I'll be back to 1-2 days battery on a single charge with normal use.

If you are interested in seeing what's what with your battery, there're apps and there're apps. Some of them work better with root access. Some don't need it. I like BetterBatteryStats, but there's also Wakelock Detector and GSAM Battery Monitor.
« Last Edit: March 26, 2015, 02:14:18 AM by Calach Pfeffer »
when ur a roamin', do as the settled do o_0

Re: Google Services Framework vs your smartphone battery in China
« Reply #1 on: March 26, 2015, 07:03:42 PM »
Well that was short-lived. For yesterday, no Checkin Service wakelock at all. Today... a few minutes worth so far. It fires up when wifi or data is on and I haven't had it on much today. I'll find out later if it's the same as always or, as I hope, much reduced. Something, obviously, is starting the service again without reference to the receivers mentioned above. I did fire up Google Play last night, so maybe that's it.
when ur a roamin', do as the settled do o_0

Re: Google Services Framework vs your smartphone battery in China
« Reply #2 on: March 28, 2015, 04:35:23 PM »
Well Google, my phone has been awake for one hour of the last two. The screen was on for all of one minute while the phone I thought had been idling on a sideboard waiting for me to come home, was awake with partial wakelocks on Config Service fetch (40mins, 58s), *net_scheduler* (9 mins, 23 sec), and Checkin Service (7 mins, 46 sec). So Google, anything to say for yourself? No?

Furthermore, in the olden days, I could freeze your sneaky eavesdroppers and note senders, and they'd be there waiting when I unfroze them to use briefly every so often. Nowadays, freezing somehow also removes account details, meaning I have to set up the account again every time I unfreeze. It seems like you've outsmarted the people who'd like to keep your services, as sneaky as they are, while in China.

Going the full delete, or even the temporary freeze, on Google Play Services and Google Services Framework has an added difficulty in Android 5.x. You have to find replacements for SMS and Email (and probably for Calendar too but who uses that weirdly conceived app anyway?) because the usual Email app now redirects to Gmail, which requires Google Services Framework, and whichever Google app you choose for SMS, Hangouts or Messenger, also depends, you guessed it, on Google Services Framework. Not that there aren't lots of replacement apps, but since the invention of Google's Material Design, lots of those apps now look like throwbacks to ye olden Linux days - they're chock full of features and little or no aesthetic sense...

For sms, Textra does a good job of emulating the simplicity and design of Google Messenger. For email, if you can find it, the plain old AOSP Email is best. I copied mine over from Cyanogenmod on another phone. So I'm about ready to pull the plug on Google on my phone. Just to see if I can get by, you understand. Just to see if I can function halfway outside the umbrella of an organization with nearly worldwide reach.

omg what am i thinking
when ur a roamin', do as the settled do o_0

Re: Google Services Framework vs your smartphone battery in China
« Reply #3 on: March 29, 2015, 05:15:05 PM »
Oh Google, you miserable motorscooters! HDR in Google camera is linked to Google Services Framework. Freeze the framework and you gain battery like new but you lose HDR. Thanks Chinogle.
when ur a roamin', do as the settled do o_0

Re: Google Services Framework vs your smartphone battery in China
« Reply #4 on: September 19, 2015, 02:32:48 PM »
So after various kinds of experiment, what actually works is:

root + xposed framework + greenify

Xposed is a bit all over the place with versions. There's the alpha release for Lollipop and the actual release for everyone else. But on their respective versions of Android, they both work. And once they're running, you can get the Greenify module that allows for the "hibernating" of apps. Note well: you can try all this with the free version of Greenify, but it might not work.

Anyway so, get root, install xposed, install and start Greenify. Have Greenify show you your system apps. Find and "hibernate" Google Play Services.

You'll need to monitor Greenify for a few days, maybe a week, because Google Play Services won't go quietly into the hibernian night. Open Greenify and you'll likely find Google Play Services listed as Not hibernating properly. In which case, tap the entry and select the scissors. (The scissor icon tells you what "wake up path" caused the hibernated app to wake up again, and you can then, if you wish, cut that path.) Over time, you'll find and cut off all the paths waking up your Google Play Services you boom, you get your battery back.

Note also, under this regime you still have access to Google Play Services. It will de-hibernate when explicitly called by, for instance, you initiating a sync operation, or perhaps you calling Google Play itself. What it won't do is wake up your phone by itself to try and sync the thousands of useless sync things it can't reach from China.

One thing you might also like to do, if Greenify doesn't seem as effective as it should be, is use the paid version of Titanium Backup to convert Google Play Services from system app to user app. That supposedly makes things easier.

Now, battery life is hard to measure but using these procedures mine has most definitely improved. I'd say boosted by somewhere between a third and a half, which is fairly phenomenal.

Now if I could just get rid of wlan_rx_wake.....
when ur a roamin', do as the settled do o_0

Re: Google Services Framework vs your smartphone battery in China
« Reply #5 on: November 02, 2015, 07:56:05 PM »
So it turns out you don't need xposed. There's some neat tricks you can do with greenify if you do have xposed, but just for hibernating Google Play Services, you need only the paid version of Greenify and root.

Greenify is a leetle bit counterintuitive to set up. For ease of exposition I shall say "menu" when I mean the three dot in-app menu found at the top right corner of the app screen. Thus, the how to of making Google Play Services behave:

(1) install and start Greenify
(2) go to: menu > Experimental features > Working Mode, and select "Root"
(3) go to: menu > Experimental features > Greenifying system apps, and tick the box
(4) go back to the main screen, select "+"
(5) you will see a short list of apps, but you want to select menu again, and tick the box for "Show all"
(6) you will see a much larger list of apps, and somewhere in there will be "Google Play services"
(7) after selecting "Google Play services, look for the circle at the bottom of the screen with the green tick, and tap it
(8 ) You will get a message about "Sorry, system app is not safe to be greenified in general", but you should tap "insist"
(9) after that, you'll see the main screen, but this time with Google Play services listed, and probably a notation "NOT HIBERNATING AUTOMATICALLY"
(10) select Google Play Services
(11) tap the "ZZZ' button at the bottom of the screen
(12) you will get a "Warning - App in this state [blah blah blah]" - tick the box marked "Always ignore running state", and then "Continue"
(13) select Google Play services again
(14) at this point, you either select "ZZZ" at the bottom of the screen and thus attempt to force the hibernation, or, if it is present, you select the scissor icon at the top right of the screen.
(15) Tapping scissor icon will give you a "Warning - cut off the wake-up path [blah blah blah]", but if you actually want Google Play services to hibernate, you have to cut that path, and most of the other ones too. There are lots of them. The only path that actually will break Play Services functionality is the one called "AccountAuthenticator{GoogleAccountAuthenticatorService}]". For that one, tap "ZZZ" instead.

And boom, the rest is housekeeping. Every time you think of it, open/refresh Greenify and if Google Play services if listed as Not Hibernating, do steps 13-15 again. After some iterations in various conditions (after a reboot, for instance, or a use of Google Play, or ffs a phone call) Greenify will mostly look after itself. You may want to monitor the functionality of your phone. If you rely on Google sync or some arcane thing to do with your Google account, this greenifying process may cut it off. Hasn't mattered to me.

Lastly, for best results, hibernate Google Play too (and you'll stop seeing so many instances of the Authenticator wake-up).


NB: none of this stops Google Play from working. If you tap it like any other app, it'll start up and do its thing. Manual syncing of data still works too. All that's stopped is the endless wakelocks associated with Google Play Services *failing* to contact Google servers from China.
« Last Edit: November 02, 2015, 08:01:44 PM by Calach Pfeffer »
when ur a roamin', do as the settled do o_0