Android - Enable and disable system apps via ADB
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:
- 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
- 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.
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 adb 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 adb 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.
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).