I actually made this module for my personal own use, but who knows, someone here might find it useful as well.
UPDATE NOTES :
OOS Nougat & Oreo User might not be able to find system app on Battery Optimisation list, you can work around this by using 3rd party app like Greenify or Naptime to open Doze Whitelist, you will see Google Play Services already listed as "Optimised App". Or go to App Info from setting, choose "Battery" and scroll down to "Battery Optimisation" - if the module work, it should written "Optimising Battery Use"
OREO User, PLEASE USE OREO version. v6 Update is already in the Magisk Repo.
I always find that Google Play Services is way too aggresive in doing its activities in the background. And its no secret that this main services from google is oftenly one of the main culprit for the sub par battery performance on most stock or even custom ROM across devices.
THE IDEA & THE BARRIER :
Starting in Android 6.0, Google has introduced one of my favorite features in battery saving : DOZE (quick read about this Here), it help us to make apps go into a "shallow" hibernation state. Where it use less energy but retain it's functionality.
Thing is, this feature is NOT applicable for Google Play Services. Thus, it cant help you to save the battery from being eaten by Google Play Services. And this is not for no reason of course (read SIDE EFFECT/NOTE section bellow for further explanation)
THE SOLUTION :
Quick study (if you are interested, one of the discussion can be found Here) reveal that Google put simple configuration is /system/etc/sysconfig/google.xml that WHITELISTING Google Play Services from the DOZE Mechanism.
So to make DOZE able to work on it, we simply need to remove the whitelisting.
This is WHAT THIS MODULE DO - SYSTEMLESSLY (obviously)
By installing this module, you can move Google Play Services from the "App Not Optimised" list to "App Optimised" which mean DOZE mechanism will work its magic on Google Play Services, thus should saving you more juices/batt throughout the day.
THE SIDE EFFECT/NOTE :
Saving energy never come without side effect. Same goes with this method.
By enabling Doze on Google Play Services, it will theoritically delay/pause some it's services. Most noticeable might be the GCM (cloud messaging) services.
App that use this services might experience delay in notification when Doze already kick in.
Although, in my experience (i use this mod on all of my three devices) my notif for LINE, WhatsApp and Telegram (my main comm app) is never been delayed. ( I put all these apps in my whitelist btw)
The one i noticed had slight delay is GMail. But i check my mail regularly throughout the day, so i need no real time notif for that.
As for all other main services like Accounts, Alarm, Location and elses, i never have any issue with them when i got this module active. GPS work fine, Alarm ringing, Account Syncing normally.
HOW TO INSTALL :
SO if after reading all the PROs and the probable CONs above , you still interested in trying this mod,
Simply dowmload it from the attachment, and install it through your MAGISK MANAGER. And reboot.
After reboot, go to "Setting" - "Battery" - tap the tri-dot menu on the top right and choose "Battery Optimisation"
Choose "All Apps" and switch ON the toggle for Google Play Services (in most ROM, it will be automatically switched to ON once this mod is installed)
ENJOY THEN !
WHAT IS THE DIFFERENCE between (+) and standard module ?
• Plus (+) version modified by @VR25 has an extra feature, which removing Google Play Services from Background Data Access Whitelisting. Thus enabling data saver or restricting background data will impact Google Play Services as well. This might save you extra juice, but BEWARE for interrupted background data activities.
Choose the one suit you most.
This Mod should compatible with any Marshmallow and Nougat ROM (Official & Custom) that has Google Play Services Installed on it,
Tested on :
OOS, LOS, CM13, MIUI, EMUI, and TouchWiz
If you found that this module causing issue for your set up, simply uninstall it from magisk manager, or use the TWRP Uninstaller.
Screenshot of expected level of Google Play Services Battery Usage :