[SCRIPT][GUIDE] Reduce google play services battery drain [8.3.0.0]

Search This thread

rbedell

Senior Member
Jul 22, 2012
929
352
Sorry, I was mistaking. Your ROM should have init.d support, too.
Just try to follow the steps for the manual method in OP. Then you'll find out.

Someone correct me if I'm wrong please but you might be able running this scrip also without init.d support of your current rom with a terminal emulator by placing the extracted .sh file into a folder on your SD and run the scrip from there with the terminal emulator. Obviously with the path for the file adjusted. Thus, will not run on every boot.
So if it's a factory image from Google, with root, recovery and custom kernel, then stock from Google doesn't support init.d? The ROM itself must have support... Right?

Sent from my Nexus 6 using Tapatalk
 

Eike81

Member
Aug 11, 2014
25
8
Well,

for myself, I'm not an expert on init.d and scripting but what I have gathered so far form search is that if you haven't got an init.d folder under ./system/etc/ one of the below might be a the reason:

1st - your software has no init.d support. If your unsure ask in your ROM OP, or try figuring out yourself by following "manual method" from this OP.
2nd - your file explorer has no root access and you won't see that folder, if present.

I just had a quick look to your Kernel OP and found the below:
http://forum.xda-developers.com/showpost.php?p=64385234&postcount=1838

Might be applicable for you...
 
Last edited:

Beakhole

Senior Member
Nov 12, 2013
656
393
I tried, folder doesn't exist, I tried to create it, (ROM toolbox) operation failed. Still kinda stuck. Would love to do this on the stock Google marshmallow.

Sent from my Nexus 6 using Tapatalk

Sorry, I was mistaking. Your ROM should have init.d support, too.
Just try to follow the steps for the manual method in OP. Then you'll find out.

Someone correct me if I'm wrong please but you might be able running this scrip also without init.d support of your current rom with a terminal emulator by placing the extracted .sh file into a folder on your SD and run the scrip from there with the terminal emulator. Obviously with the path for the file adjusted. Thus, will not run on every boot.

You do not need init.d for this script to work. Like I said before, flashing the zip that I made is not going to work and there is actually no need whatsoever to have init.d to use this script. Just follow the OP's instructions to execute the script from the Terminal on your phone.

 
  • Like
Reactions: rbedell and Eike81

donjuro

Senior Member
Jun 6, 2013
174
23


@Choristav, I can't use your FixGSv4 since moving to Marshmallow. I can't get a good GPS lock when navigating with Google Maps. It doesn't know to orient to the same direction that I'm actually facing in my car. Also, it stay with me. I'll start driving and it doesn't follow me except to jump to my location every few blocks as I drive. If I don't use this script then I have no Maps navigation issues whatsoever. It sucks because I was seeing real battery savings.


I can confirm that the compass is not working correctly. I tried to recalibrate it but had no luck.
 

Ciao600

Senior Member
Oct 15, 2012
320
45




You do not need init.d for this script to work. Like I said before, flashing the zip that I made is not going to work and there is actually no need whatsoever to have init.d to use this script. Just follow the OP's instructions to execute the script from the Terminal on your phone.

If I use manual method (flashing Zip from recovery and execute it via terminal emulator) will I have to execute it via terminal emulator after every reboot? If yes, can I delete ".sh" from the name file so I won't need to do it every reboot?
Thanks
 

Beakhole

Senior Member
Nov 12, 2013
656
393
If I use manual method (flashing Zip from recovery and execute it via terminal emulator) will I have to execute it via terminal emulator after every reboot? If yes, can I delete ".sh" from the name file so I won't need to do it every reboot?
Thanks

There is no need to flash the zip. There is also no need to place the script file in init.d because the script does not need to be run on every boot. Once you run the script, the disabled services stay disabled until you reinstall GApps, i.e. after a rom update.

TL;DR: just run the script per the OP's instructions after each rom update. Your rom does not need init.d to use this script.

 
Last edited:

rbedell

Senior Member
Jul 22, 2012
929
352
What would be the best way to modify this? For instance, I want it to back my photos up while plugged in but sync is set to off on my Google photos app...

Nvm, figured it out. Thanks anyway.
Sent from my Nexus 6 using Tapatalk
 
Last edited:

Beakhole

Senior Member
Nov 12, 2013
656
393
What I meant is that the revert script did not work.
Could I remove some lines from the script so that the gps still works but some of the benefits are still there?

Yeah. It's just a script file full of commands. Remove the commands (lines) that you don't want and then execute that from the terminal and it'll be just fine.

 

PWn3R

Senior Member
Dec 10, 2010
904
985
Flagstaff
Nexus 7
Motorola Droid X
I've been using this script for a while, but I'm having an issue now on MMB29T (Beanstalk ROM that I made) it now gives "unkown id: disable" as the result for every line (or : enable). Could the Google Play Services update recently have changed the ID of every one of these?

Edit: IGNORE THIS - Make sure you have SuperSU or it won't work.
 
Last edited:

nixie2121

Senior Member
Mar 2, 2011
1,433
242
sorry if this has been posted but.. what won't work with this in place? what kind of battery gain have you seen? thanks so Much
 

Ergo Proxy

Senior Member
Jul 16, 2012
373
285
London
Flashed FixGSExtendedv4-signed.zip on my LG G4 running stock marshmallow and it's working great, heavily reduced Google play services battery drain.
Running for a while now and so far so good, nothing seems to be broken (tested maps, Gmail, and other stuff), good job.
 
  • Like
Reactions: hooliganx

Top Liked Posts

  • There are no posts matching your filters.
  • 80
    These past days I've been plagued with Google Play Services draining my battery, especially using the location services. Using Privacy Guard I could clearly see the absurd amount of times my location was requested, even with the location services OFF.

    So I went digging and you wouldn't believe the amount of services and providers that google uses to enforce their location track onto the phone.


    I am VERY selective with my startup apps, ranging from greenify to swiftkey and adaway, but nothing that explicitly requires any location services whatsoever. I know whatsapp requests your location, but only when you open it. At startup, with very few and selective apps starting up, NOTHING should require your location (having location services OFF), unless there's something that actively tries to monitor where you are (IE: watchdog service, locate my phone, etc).

    By default, I had a LOT of requests from the play services for my location CONSTANTLY. I also had 6 or 7 services running in my phone associated with gapps (configfetch service, dispatchingservice, analytics, geolocation, etc).

    By disabling all of what I disabled, I managed to decrease the amount of location requests (and therefore wakelocks and idle battery consumption) while still retaining basic functionality like being able to use google maps.

    I effectively disabled GOOGLE LOCATION REPORTING, which IS ALWAYS RUNNING IN THE BACKGROUND and CAN NOT BE DISABLED unless you break the mechanism. How do I know? I used Greenify + Donation, and checked "Reveal hidden sync", then I went into accounts-> Google and BAM, location reporting was ALWAYS IN-SYNC, even if you disable it, after a reboot it would come back.

    This is XDA so let's get technical, but first, proof:

    Screenshot_2015_06_19_15_56_43.png


    Automatic method:

    1 - If you're using SuperSU, go into settings -> SuperSU -> Settings -> Enable SU during boot

    2 - If you're unsure your rom has init.d support, try Universal init.d. If you're NOT using a nexus please let us know if it works (I'm looking at you touchwiz users ;))

    3 - Go to the bottom of this post. Download either FixGS.zip or FixGSExtended.zip, flash through your recovery.

    4 - After your next reboot it will take a while (couple of minutes tops, depends on eMMC speed, encryption, etc) to disable all the services. Go back into the SuperSU settings and DISABLE SU during boot.

    5 -That's it, if you need to revert either script, a _REVERT script is also attached at the bottom of the post.

    FixGS has all the essential location services enabled. FixGSExtended furthermore disables all the items noted below, under "Additional stuff to remove" in the manual method.

    Manual method:


    1 - Go to the bottom of this post

    2 - Download either FixGS.zip or FixGSExtended.zip, extract the .sh file from it.

    3 - Place it in /system/etc/init.d/ and give it 755 permissions (allow all execute and read boxes, only allow owner to write)

    4 - If you're unsure your rom has init.d support, try Universal init.d.

    4b - I use terminal emulator for Android to execute the script. Simply write
    Code:
    su
    ./etc/init.d/FixGS.sh
    
    or
    
    ./etc/init.d/FixGSExtended.sh
    5 -That's it, if you need to revert either script, a _REVERT script is also attached at the bottom of the post.
    14
    Hi, @Choristav this works on Marshmallow? I used in Lollipop, but now I updated my phone to Marshmallow. Thanks!

    It does, but do try the new version.

    Mantaining this thread isn't that hard, but it's time consuming, mostly because google updates are very irregular and sometimes a pain in the ass, especially when they rename rather than add/remove services. I'll continue to do it as long as google adds anything significant to their apk updates, don't think I left this thread for dead.

    Anyhow, v4 is uploaded, plenty of stuff is changed. I've re-enabled fused location, let me know if it's for better or for worse. I know many google services intend to bring better stability/battery life, but sometimes they just get stuck in a loop and don't let a device sleep. So there's a dilemma, having a specific battery-service always on, or disable it altogether. Anyways, let me know.

    Oh and, the scripts are flashable now, thanks to @misterpyrrhuloxia. I might add my name so people know where the script came from as well as a mention to the script creator later. Maybe someone could help me with the updater-script? For some reason the _REVERT.sh file never gets copied into the init.d folder. I'm attaching them to this post.

    Also the revert scripts will be uploaded as soon as I can make them work.

    Big thanks to @1ceb0x for giving feedback and support. You are very free to have a custom version of the script going, even in this thread.
    Also thanks to @paffo for additional debugging.

    I probably missed someone but I'm too tired at the moment.

    Thread will have a play services version in the title for easier organization. If anyone is using the script or there's another thread on anything but a g2/nexus 6, let me know!
    9
    Update 2:

    Disabled:
    Code:
    [Activities]
    N/A
    
    [Providers]
    N/A
    
    [Receivers]
    N/A
    
    [Services]
    com.google.android.location.internal.AnalyticsUploadIntentService
    com.google.android.gms/.kids.chimera.LongRunningServiceProxy

    Removed/obsolete:

    Code:
    [Activities]
    com.google.android.location.copresence.settings.ProximitySettingActivity
    nearby.sharing.sharesheet.ShareHintActivity
    nearby.sharing.sharesheet.ShareActivity
    nearby.sharing.settings.TrustDeviceDialogActivity
    nearby.sharing.settings.OptInActivity
    nearby.sharing.AppNotSupportedDialogActivity
    nearby.sharing.AppNotInstalledDialogActivity
    
    [Providers]
    N/A
    
    [Receivers]
    common.status.StatusServiceLauncherBroadcastReceiver
    config.ConfigFetchService$SecretCodeReceiver
    config.ConfigFetchService$PackageReceiver
    car.BluetoothReceiver
    nearby.sharing.NearbySharingBroadcastReceiver
    nearby.sharing.ui.UiReceiver
    nearby.sharing.GcmBroadcastReceiver
    
    [Services]
    common.status.StatusService
    com.google.android.location.internal.AnalyticsUploadService
    com.google.android.location.copresence.service.ProximitySettingInjectorService
    config.ConfigFetchService
    com.google.android.libraries.nearby.direct.service.NearbyDirectService
    com.google.location.nearby.direct.service.NearbyDirectService
    kids.chimera.UserSwitchListenerServiceProxy

    Previous updates:

    Update 1:

    Main script changelog:

    Disabled the following items:
    Code:
    [Activities][b]
    N/A
    [/b]
    [Providers][b]
    N/A
    [/b]
    [Receivers][b]
    N/A
    [/b]
    [Services][b]
    backup.BackupStatsService
    [/b]

    Re-enabled the following items:

    Code:
    [Activities][b]
    N/A
    [/b]
    [Providers][b]
    common.stats.net.contentprovider.NetworkUsageContentProvider
    [/b]
    [Receivers][b]
    N/A
    [/b]
    [Services][b]
    ads.AdRequestBrokerService
    ads.identifier.service.AdvertisingIdService
    common.stats.GmsCoreStatsService
    com.google.android.location.places.service.GeoDataService
    stats.PlatformStatsCollectorService
    usagereporting.service.UsageReportingService
    common.stats.GmsCoreStatsServiceLauncher
    [/b]

    Extended script changelog:

    Re-enabled the following items:

    Code:
    [Activities][b]
    N/A
    [/b]
    [Providers][b]
    N/A
    [/b]
    [Receivers][b]
    N/A
    [/b]
    [Services][b]
    phenotype.service.PhenotypeService
    playlog.service.MonitorAlarmReceiver
    playlog.service.WallClockChangedReceiver
    playlog.service.MonitorService
    playlog.service.PlayLogBrokerService
    playlog.service.PlayLogIntentService
    playlog.uploader.RequestUploadService
    playlog.uploader.UploaderService
    car.CarService
    [/b]
Our Apps
Get our official app!
The best way to access XDA on your phone
Nav Gestures
Add swipe gestures to any Android
One Handed Mode
Eases uses one hand with your phone