Is there any way to disable autostart apps at boot time? I need to disable some of them (not all) like Facebook, etc to get quicker boot time. I'm asking how to do this on Android 9.0.
-
Preventing an app to start on startup requires root permissions: https://stackoverflow.com/questions/9715214/how-to-disable-run-the-app-by-boot-completed – Robert Mar 22 '19 at 17:59
2 Answers
Without getting into the details whether or not one should stop autostarting apps, and what could be the consequences as discussed in a plenty of other answers, here are my simple solutions which may work without any third party apps, at least on Android Pie.
ROOT SOLUTION:
Apps use BroadcastRceivers
to listen for broadcast ACTION_BOOT_COMPLETED so that they can run on boot. Broadcast receiver is an app component that can be disabled with root privileges.
Using Package Manager list all broadcast receivers listening for BOOT_COMPLETED:
~# pm query-receivers --components -a android.intent.action.BOOT_COMPLETED
It will give a list of broadcast receivers in format package_name/component_name
. See dumpsys activity broadcast-stats
and dumpsys activity broadcasts
for more details.
Now to disable a component:
~# pm disable <package/component>
There are apps like Autostarts
(com.elsdoerfer.android.autostarts) and SD Maid
(eu.thedarken.sdm) which can do same for you. File /data/system/users/0/package-restrictions.xml
can also be edited directly to disable apps or their components, but it's not recommended.
It's possible to disable multiple broadcast receivers of an app, and a single receiver can also possibly listen to multiple types of broadcast events.
NON-ROOT SOLUTION: (non-universal)
In order to receive android.intent.action.BOOT_COMPLETED
, apps need android.permission.RECEIVE_BOOT_COMPLETED which is a normal permission and hence can't be revoked by user.
However there is a hidden permission management framework, named AppOps
that provides a slightly more fine-grained control of (permission-like) operations. OP_BOOT_COMPLETED is one of those but it's not a part of AOSP, only added by some custom ROMs like LineageOS. If you are on one of such ROMs, you can control the autostart behavior through adb shell
:
~$ appops set <package> BOOT_COMPLETED deny
Now the app won't be allowed to receive BOOT_COMPLETED broadcast. There are apps like App Ops
(rikka.appops) which can do same for you. Some custom ROMs have built-in front-ends to AppOps with different names like Privacy Guard, AutoStart Manager etc.
Please note that AppOps:
is not generally intended for third party application developers; most features are only available to system applications
So its usage without root may be disallowed or get harder in next Android releases.
Both of the above methods can stop apps from starting on boot only. An app can listen for some other broadcast events too and it can keep on restarting if killed, or run in background continuously (as a service) if it's designed to be so. See dumpsys activity services
for more details.
A slightly different approach would be to stop apps from running in background by using OP_RUN_IN_BACKGROUND (introduced in Nougat) and/or RUN_ANY_IN_BACKGROUND
(introduced in Pie) which are part of AOSP:
~$ appops set <package> RUN_IN_BACKGROUND deny
They don't have an equivalent manifest permission, but there is an experimental permission with same name.

- 20,353
- 3
- 70
- 213
-
2This question was marked as duplicate but other questions doesn't have good answers as yours. Thanks. I think that AppOps is easy solution. I forgot to add in question, I have rooted my phone. – QkiZ Mar 23 '19 at 10:22
-
@QkiZ yes, provided that your ROM supports it. Or you can go for root option. – Irfan Latif Mar 23 '19 at 12:49
-
since when is
pm query-receivers
supposed to work? on my Android 7 I get: "Error: unknown command 'query-receivers'" – Frederick Nord Jul 08 '19 at 07:14 -
@FrederickNord seems like this was added in Nougat: https://android.googlesource.com/platform/frameworks/base/+/6ac42aeed905181b484f97a53db57a17134ef7a8%5E%21/#F12. Also try
query-intent-receivers
. – Irfan Latif Jul 08 '19 at 07:38 -
It says "error: unknown operation string: RUN_IN_BACKGROUND" i tried also wiith RUN_ANY_IN_BACKGROUND and OP_RUN_IN_BACKGROUND, Edit: my version has it not https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-6.0.1_r81/core/java/android/app/AppOpsManager.java – VeganEye Jun 17 '21 at 01:44
-
1@VeganEye probably you didn't read the answer: "A slightly different approach would be to stop apps from running in background by using OP_RUN_IN_BACKGROUND (introduced in Nougat) and/or RUN_ANY_IN_BACKGROUND (introduced in Pie)" – Irfan Latif Jun 17 '21 at 07:49
-
You should add this answer to the "duplicate" questions for higher visibility, it's better then all the other answers there. – I'm_With_Stupid Nov 26 '22 at 07:25
-
Can confirm the root option works on Android 13. I disabled the receivers in the app SD Maid's AppControl for Spotify and worked. I had to factory reset the app to get it all working without a hitch, but that might just be a Spotify storage problem. – I'm_With_Stupid Nov 26 '22 at 07:36
Some devices require root access to manage auto start permissions... However Android 5.1 Allows this via Auto Start settings in Security.
This option should be available on any system with AppOpps
Also If Not On Android with these settings
Open Settings
Open Apps
Open the desired Application
Select Permissions
Disable Auto-start permission

- 1,590
- 1
- 8
- 11
-
Which device are you using? I have used stock ROM is Nexus 6 (Android 5.x - 7.x) and OnePlus 6 (Android 8.1) , and I never came across such an option. – Firelord Mar 22 '19 at 21:56
-
@Firelord it's common on custom ROMs to have an AppOps manager builtin. It's not a stock AOSP. – Irfan Latif Mar 23 '19 at 00:04
-
-
Yes, appops is part of AOSP, but that option in the screenshot is not available. That's what I meant. Which device and ROM are you using? – Firelord Mar 23 '19 at 07:06
-
1
-
@Firelord it's built with many releases of CM, LineageOS, AEX, RR and even OmniRom if I remember correctly. – Irfan Latif Mar 23 '19 at 07:19
-
-
@Zillinium it would be helpful if you provide link to AOSP where the source code of Auto-start management exists. – Irfan Latif Mar 30 '19 at 06:09
-
It is not called Auto-start management.. It is permission management... Auto Start requires the following permission... "android.permission.RECEIVE_BOOT_COMPLETED" .. ... You stop or Manage the Auto-start by disabling the Receive Boot Completed permission for that application... Please Reffer TO... Permission Management... – Empire of E Apr 01 '19 at 00:12