6

Assume that I'm a user who doesn't like some system apps being automatically white-listed under Battery optimization settings and immune from battery optimization or is fed up with Play services consuming more than its fair share of battery. I'm looking for a solution which would revoke this privilege enjoyed by those apps and add them into the line where the rest of the ordinary comrade apps are waiting for the user to mark them with Don't optimize.

(Click image to enlarge)

IMG:

I've already seen this answer and as noted in a comment it doesn't work for apps white-listed by system.

As of now, these are the apps white-listed by Android 6.0.1 in my rooted Nexus 6:

IMG

I'm most interested in removing com.google.android.gms.

2 Answers 2

9

Requisites

  • A rooted Android

Optional:

  • A full ROM backup made through a custom recovery. It is for your own convenience. If something suggested in the next section causes boot issues or system/app crashes, you would have something good to fallback to earlier state.

  • Optimizing Play services may cause unforeseen consequences (including Android Device Manager or device tracking apps not functioning appropriately). You are advised to calculate the number of installed apps which depends upon Google Cloud Messaging and would be affected by this move. The answers here may help: Is there a way to see which apps are using GCM?

    I preferred my own answer for simplicity.


FOR AVOIDING THE HASSLE

If you are targeting only Google Play Services and wants to avoid the hassle of editing system files, you can use Enable Doze for GMS or SysConfig Patcher Magisk Module. You would be needing Magisk framework and Magisk Manager.


As I noted here, Google Play services is white-listed by Google through the file google.xml located under /system/etc/sysconfig/. Among other things, the file notes:

<!-- GmsCore must always have network access for GCM and other things. -->
<allow-in-power-save package="com.google.android.gms" />

Comment out the highlighted line using <!-- at the start and --> at the end. The line should now look like:

<!-- <allow-in-power-save package="com.google.android.gms" /> -->

(Click an image to enlarge it)

IMG: IMG:

Reboot the device and behold Google Play services now not available under Not optimized tab but available for optimization.

(Click an image to enlarge it)

IMG: IMG:

I observed that the list of apps decreased too:

IMG

Note: I used ES File Explorer to browse to the directory /system/etc/sysconfig and used QuickEdit to edit google.xml. It is not mandatory to use these tools. You can use whatsoever you find convenient.

Now, for the rest of the names in the list, refer to corresponding files noted below:

  • com.android.providers.downloads : /system/etc/permissions/platform.xml
  • com.android.vending: /system/etc/sysconfig/google.xml -- I noticed that dealing with Google Play services automatically removed Play Store from the list
  • com.google.android.apps.tycho : /system/etc/sysconfig/google_build.xml
  • com.android.omadm.service : /system/etc/sysconfig/whitelist_com.android.omadm.service.xml.

Comment out the appropriate line, reboot and your tweak should work.

Note: I've extrapolated my findings with Google Play services here.

SystemConfig.java is used to read configuration from the directory /system/etc/permissions and /system/etc/sysconfig. So, if you have a white-listed system app not manually added and not covered in this answer, then focus your search into those two directories at first.

3
  • Hi @Firelord. I tried this solution of in Android 7.1.1 to the point of me ultimately deleting the line for GMS to no avail. Any ideas on what changed in Android Nougat regarding on how this is implemented? Thanks.
    – user42850
    Commented Apr 8, 2017 at 4:02
  • @user42850. I'm sorry to hear that. But I do not have Android Nougat at my disposal, so I'm not in a position to help you in this case. :(
    – Firelord
    Commented Apr 8, 2017 at 10:53
  • I have taken care of your concern in this edit: android.stackexchange.com/posts/143248/revisions (I'm late by an year though).
    – Firelord
    Commented Apr 11, 2018 at 15:18
0
adb shell dumpsys deviceidle whitelist -"com.yourcompany.yourapp"

Using this command in adb you can remove apps from power saving exclusions, tested in Oreo ,non rooted And using a plus (+) sign instead of minus- you can add apps into the exclusion list.

Editing again. There's an error. It's not working always

1
  • It cannot remove the default set of apps whitelisted. Can it remove Google Play Services? Please provide evidence to support your claim. BTW, my question was asked with reference to Android 6.0, though I wouldn't mind if your answer works for Android Oreo for every app.
    – Firelord
    Commented Sep 28, 2018 at 17:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .