Call package manager (pm)

Within an adb shell, you can issue commands with the package manager (pm) tool to perform actions and queries on app packages installed on the device. You can issue a package manager command directly from adb without entering a remote shell. For example:

adb shell pm uninstall com.example.MyApp

Command

Prints all packages, optionally only those whose package name contains the text in filter. Options:

adb shell pm list packages [options] filter

Prints all known permission groups.

adb shell pm list permission-groups

Prints all known permissions, optionally only those in group. Options:

adb shell pm list permissions [options] group

List all test packages. Options:

adb shell pm list instrumentation [options]

Prints all features of the system.

adb shell pm list features

Prints all the libraries supported by the current device.

adb shell pm list libraries

Prints all users on the system.

adb shell pm list users

Print the path to the APK of the given package.

adb shell pm path package

Installs a package (specified by path) to the system. Options:

adb shell pm install [options] path

Removes a package from the system. Options:

adb shell pm uninstall [options] package

Deletes all data associated with a package.

adb shell pm clear package

Enable the given package or component (written as "package/class").

adb shell pm enable package_or_component

Disable the given package or component (written as "package/class").

adb shell pm disable package_or_component

Options:

adb shell pm disable-user [options] package_or_component

Grant a permission to an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app.

adb shell pm grant package_name  permission

Revoke a permission from an app. On devices running Android 6.0 (API level 23) and higher, the permission can be any permission declared in the app manifest. On devices running Android 5.1 (API level 22) and lower, must be an optional permission defined by the app.

adb shell pm revoke package_name  permission

Changes the default install location. Location values:

Note: This is only intended for debugging; using this can cause apps to break and other undesireable behavior.

adb shell pm set-install-location location

Returns the current install location. Return values:

adb shell pm get-install-location

Specifies whether the given permission should be enforced.

adb shell pm set-permission-enforced permission [true | false]

Trim cache files to reach the given free space.

adb shell pm trim-caches desired_free_space

Create a new user with the given user_name, printing the new user identifier of the user.

adb shell pm create-user user_name

Remove the user with the given user_id, deleting all data associated with that user

adb shell pm remove-user user_id

Prints the maximum number of users supported by the device.

adb shell pm get-max-users