49

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

Thanks

67

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.
  • Is it possible to avoid hiding of the chosen app when disabling it? – android developer Apr 18 '14 at 13:03
  • 1
    @androiddeveloper No. Hiding the app completely, including from the UI, is the entire idea behind it. – Izzy Oct 31 '14 at 12:43
  • @Izzy I see. Is it possible to do the opposite, meaning just hiding, without disabling? – android developer Oct 31 '14 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 Oct 31 '14 at 12:54
  • it's possible to enable the app by it's playstore page. – Info-Screen Nov 23 '16 at 13:41
7

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 changes.

Firstly, 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 can't.

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 pacakges --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).

3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.