82

Is there any adb command to enable/disable a system app?

Thanks

4 Answers 4

93

Yes. The command is pm disable <package name>. You must be root in order to do this:

Open shell and get root:

PC> adb shell
shell@hammerhead:/ $ su

List all enabled apps, filter by "calculator":

root@hammerhead:/ # pm list packages -e | grep 'calculator'
package:com.android.calculator2

Disable app:

root@hammerhead:/ # pm disable com.android.calculator2
Package com.android.calculator2 new state: disabled

List all disabled apps:

root@hammerhead:/ # pm list packages -d
package:com.android.calculator2
package:com.google.android.apps.inputmethod.hindi
package:jp.co.omronsoft.iwnnime.ml
package:com.google.android.inputmethod.pinyin
package:com.google.android.inputmethod.korean
package:com.google.earth
root@hammerhead:/ #

Some other things worth noting:

  1. In my testing, apps disabled in this manner disappear completely from the Settings > Apps list. They do not even seem to be displayed in the "Disabled" tab
  2. You can re-enable apps with pm enable <package name>. In fact, this seems to be the only way to re-enable them, in my experience.
6
  • 1
    Is it possible to avoid hiding of the chosen app when disabling it? Commented Apr 18, 2014 at 13:03
  • 1
    @androiddeveloper No. Hiding the app completely, including from the UI, is the entire idea behind it.
    – Izzy
    Commented Oct 31, 2014 at 12:43
  • 1
    @Izzy I see. Is it possible to do the opposite, meaning just hiding, without disabling? Commented Oct 31, 2014 at 12:49
  • Theoretically yes I guess; but I've got no idea how to do that. There are some "apps" on the stores which do appear nowhere when installed (as they e.g. only provide additional settings in some other apps, or offer some "invisible services" like "account managers" for specific services), which proves it should work somehow; but I'm afraid that's to be done in the app's Manifest or the like (I'm no Android dev, so I cannot tell).
    – Izzy
    Commented Oct 31, 2014 at 12:54
  • it's possible to enable the app by it's playstore page. Commented Nov 23, 2016 at 13:41
24

This should work regardless whether the app is a system app or a third-party app (user installed).


See my answer at Determine the package name of your app to get the package name of the concerned app and use shell to execute these commands (requires root access):

adb shell
su
pm disable PACKAGE              # disables the app and hides it in Settings -> Applications 
pm hide PACKAGE                 # alternative; for Android Lollipop and above
cmd package suspend PACKAGE     # alternative; package remains visible in Launcher and Settings app but cannot be used; a feature of Device Administration

PACKAGE refers to package name of the app

To reinstate the app, replace disable with enable, hide with unhide, and suspend with unsuspend in the said command and execute it with root privilege.

If you've Android KitKat or above and do not have root access, use in PC to execute this command:

adb shell pm block PACKAGE         # for Android KitKat
adb shell pm hide  PACKAGE         # for Android Lollipop only
adb shell pm disable-user PACKAGE  # alternative to `pm hide`; for Android Lollipop and above; this works just like disabling an app through Settings app

To reinstate the app:

adb shell pm unblock PACKAGE   # for Android KitKat
adb shell pm unhide PACKAGE    # for Android Lollipop and only if you used `pm hide` earlier
adb shell pm enable PACKAGE    # for Android Lollipop and above

Changes would take place immediately.

4
  • out of everything else on this page, only cmd package suspend <package> worked as expected. Everything else would throw exceptions
    – iSWORD
    Commented Mar 21, 2021 at 10:16
  • @iSWORD which Android device and Android version are you using?
    – Firelord
    Commented Mar 21, 2021 at 14:14
  • 1
    I'm using a Lenovo P2a42 running AOSP 11
    – iSWORD
    Commented Mar 21, 2021 at 14:30
  • 1
    It may be a launcher issue, but for me the pm disable-user command doesn't hide an app's icon immediately, I have to restart the launcher for changes to take effect.
    – EvgenKo423
    Commented Apr 9, 2022 at 15:45
11

Further to the answer by @eldarerathis, you can disable an app for a specific user. I used this method to remove some apps from a restricted user that weren't listed on the user settings screen. All commands from an adb shell. Root access is required to make the changes.

First, get the user's id:

$ pm list users
Users:
  UserInfo{0:Alice:13} running
  UserInfo{11:Bob:18} running

Then

$ pm disable --user 11 com.cyanogenmod.filemanager
Package com.cyanogenmod.filemanager new state: disabled-user

To re-enable

# pm enable --user 11 com.cyanogenmod.filemanager

In this example, Alice can use the file manager but Bob cannot.

You can do a similar thing with hide instead of disable. I am not sure which is best, but see this answer. The converse of hide is unhide (a reboot may be needed to effect unhide).

You can list packages with pm list packages --user 11. Give -e to list enabled packages or -d if you want to see disabled ones. There would appear to be no filter for hidden packages.

FWIW: I tried the above on Lollipop with CM 12.1 on an Amazon Fire (KFFOWI).

2
  • 1
    A root access isn't mandatory, I disabled a LineageOS system app by running pm disable-user --user 0 org.lineageos.audiofx (in adb shell).
    – user598527
    Commented Nov 25, 2023 at 18:15
  • ^ Android 13 / LineageOS 20; may "hide" instead of disabling.
    – user598527
    Commented Nov 25, 2023 at 18:30
4

I wanted to disable the playstore on Vivo phone because my niece always installs multiple gigabytes of games. For some of you this might work, no root is required.

To disable playstore:

$ adb shell pm uninstall --user 0 -k com.android.vending
Success

This uninstalls the app. But there's also a way to restore the app:

$ adb shell pm install-existing com.android.vending
Package com.android.vending installed for user: 0

Of course, playstore is an example. This should work for most system apps. From the PC, you can directly run this, or if you're in an ADB shell, run the command after adb shell.

You can use adb shell pm list packages, pipe that to grep to search for the package easily.

Note that this uninstalls the app, the -k flag should keep the data. But in my case all data was purged/deleted. So there might be data loss during the process of uninstallation of system apps.

1
  • 1
    You should use cmd install-existing com.android.vending on modern Android. On android 8 pm install-existing won't work. On old Android versions (4.2) not having cmd you can try pm install -r to force the reinstallation
    – DadiBit
    Commented Nov 10 at 19:42

You must log in to answer this question.

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