Skip to content

Package Manager


adb shell pm help
adb shell pm path [--user USER_ID] PACKAGE
adb shell pm dump PACKAGE

Prints true and returns exit status 0 when the system has a FEATURE_NAME, otherwise prints false and returns exit status 1.

adb shell pm has-feature FEATURE_NAME [version]

Prints all features of the system.

adb shell pm list features

Prints all test packages; optionally only those targeting TARGET-PACKAGE.

adb shell pm list instrumentation [-f] [TARGET-PACKAGE]

Prints all system libraries.

adb shell pm list libraries

List Packages

Prints all packages and their associated files.

adb shell pm list packages -f

Prints all known packages, excluding APEXes.

adb shell pm list packages -a

Filters and shows only disabled packages.

adb shell pm list packages -d

Filters and shows only enabled packages.

adb shell pm list packages -e

Filters and shows only system packages.

adb shell pm list packages -s

Filters and shows only third-party packages.

adb shell pm list packages -3

Shows the installer for the packages.

adb shell pm list packages -i

Ignored (used for compatibility with older releases).

adb shell pm list packages -l

Also shows the package UID.

adb shell pm list packages -U

Includes uninstalled packages.

adb shell pm list packages -u

Also shows the version code.

adb shell pm list packages --show-versioncode

Only shows APEX packages.

adb shell pm list packages --apex-only

Filters and shows packages with the given UID.

adb shell pm list packages --uid UID

Only lists packages belonging to the given user.

adb shell pm list packages --user USER_ID

Prints all known permission groups.

adb shell pm list permission-groups

List Permissions

List all permissions.

adb shell pm list permission -g

List permissions and their groups.

adb shell pm list permission -f

List only system permissions.

adb shell pm list permission -s

List only disabled permissions.

adb shell pm list permission -d

List only user permissions.

adb shell pm list permission -u

List all staged sessions.

adb shell pm list staged-sessions

List only ready staged sessions.

adb shell pm list staged-sessions --only-ready

List only session IDs of staged sessions.

adb shell pm list staged-sessions --only-sessionid

List only parent staged sessions.

adb shell pm list staged-sessions --only-parent

List Users

adb shell pm list users

Prints the activity that resolves to the given INTENT.

adb shell pm resolve-activity --brief --components --query-flags FLAGS --user USER_ID INTENT

Prints all activities that can handle the given INTENT.

adb shell pm query-activities --brief --components --query-flags FLAGS --user USER_ID INTENT

Prints all services that can handle the given INTENT.

adb shell pm query-services --brief --components --query-flags FLAGS --user USER_ID INTENT

Prints all broadcast receivers that can handle the given INTENT.

adb shell pm query-receivers --brief --components --query-flags FLAGS --user USER_ID INTENT

Install package with default options for user 0

adb shell pm install -r -i PACKAGE --user 0

Install package with default options for all users

adb shell pm install -r -i PACKAGE --user all

Install package with default options for the current user

adb shell pm install -r -i PACKAGE --user current

Install package with the option to retain data and cache for user 0

adb shell pm install -t -i PACKAGE --user 0

Install package with the option to retain data and cache for all users

adb shell pm install -t -i PACKAGE --user all

Install package with the option to retain data and cache for the current user

adb shell pm install -t -i PACKAGE --user current

Install package with the option to retain only the cache for user 0

adb shell pm install -t -i PACKAGE --user 0

Install package with the option to retain only the cache for all users:

adb shell pm install -t -i PACKAGE --user all

Install package with the option to retain only the cache for the current user

adb shell pm install -t -i PACKAGE --user current

Install package with the option to grant all runtime permissions and retain data and cache for user 0

adb shell pm install -g -i PACKAGE --user 0

Install package with the option to grant all runtime permissions and retain data and cache for all users

adb shell pm install -g -i PACKAGE --user all

Install package with the option to grant all runtime permissions and retain data and cache for the current user

adb shell pm install -g -i PACKAGE --user current

Install

adb shell pm install -p INHERIT_PACKAGE

Install Location

Location Code Description
0 Auto
1 Internal Only
2 Prefer External
adb shell pm set-install-location 0/1/2

Install with Reason

Reason Code Description
0 Unknown reason
1 Replacement of an existing package
2 New installation
3 Restoration of a package from backup
4 Upgrade of an existing package
adb shell pm install-create -r -i PACKAGE --install-reason 0/1/2/3/4

Originating URI

adb shell pm install-write -S BYTES --originating-uri URI

Referrer URI

adb shell pm install-write -S BYTES --referrer URI

ABI (CPU Architecture)

adb shell pm install -r -i PACKAGE --abi ABI_NAME

Force SDK

adb shell pm install -t -i PACKAGE --force-sdk

Preload

adb shell pm install --preload

Instant

adb shell pm install --instant

Full Install

adb shell pm install -r -i PACKAGE --full

Don't Kill

adb shell pm install -r -i PACKAGE --dont-kill

Enable Rollback

adb shell pm install --enable-rollback

Force UUID

adb shell pm install --force-uuid internal|UUID

Package

adb shell pm install -r -i PACKAGE

File Size

adb shell pm install -S BYTES

Install Apex Package

adb shell pm install -g -i PACKAGE

Staged Ready Timeout

adb shell pm install --staged-ready-timeout TIMEOUT

Install Path

adb shell pm install -r -i PACKAGE --user 0 PATH [SPLIT...]|-

Install with Reason

Reason Code Description
0 Unknown
1 Admin Policy
2 Device Restore
3 Device Setup
4 User Request
adb shell pm install-create -r REASON
adb shell pm install-write --force-uuid internal|UUID
adb shell pm install-write --apex
adb shell pm install --staged-ready-timeout TIMEOUT

Install Create with User ID

To specify the user ID for the installation, you can use the following commands:

adb shell pm install-create --user USER_ID

Replace USER_ID with the desired user ID. For example, to specify the system user (ID 0), you can use:

adb shell pm install-create --user 0

Install Create for All Users

To install the package for all users on a multi-user device, you can use the following command:

adb shell pm install-create --user all

Install Create for Current User

To install the package for the current user, you can use the following command:

adb shell pm install-create --user current

install-existing

Install Existing Package with User ID

adb shell pm install-existing --user

Install Existing Package as Instant App

adb shell pm install-existing --instant

Install Existing Package as Full App

adb shell pm install-existing --full

Install Existing Package and Wait

adb shell pm install-existing --wait

Install Existing Package without Whitelisting Restricted Permissions

adb shell pm install-existing --restrict-permissions

Install Write

adb shell pm install-write [-S BYTES] SESSION_ID SPLIT_NAME [PATH|-]

Install Remove

adb shell pm install-remove SESSION_ID SPLIT...

Install Add Session

adb shell pm install-add-session MULTI_PACKAGE_SESSION_ID CHILD_SESSION_IDs

Install Commit

adb shell pm install-commit SESSION_ID

Install Abandon

adb shell pm install-abandon SESSION_ID

Install Location

0 [auto]: Let system decide the best location 1 [internal]: Install on internal device storage 2 [external]: Install on external media

Set Install Location to Auto

adb shell pm set-install-location 0

Set Install Location to Internal Only

adb shell pm set-install-location 1

Set Install Location to Prefer External

adb shell pm set-install-location 2

Get Install Location

adb shell pm get-install-location

Move Package

adb shell pm move-package PACKAGE [internal|UUID]

Move Primary Storage

adb shell pm move-primary-storage [internal|UUID]

Uninstall Package

adb shell pm uninstall [-k] [--user USER_ID] [--versionCode VERSION_CODE] PACKAGE [SPLIT...]

Clear Package Data

adb shell pm clear [--user USER_ID] [--cache-only] PACKAGE

Enable Package or Component

adb shell pm enable [--user USER_ID] PACKAGE_OR_COMPONENT

Disable Package or Component

adb shell pm disable [--user USER_ID] PACKAGE_OR_COMPONENT

Disable User for Package or Component

adb shell pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT

Disable Until Used for Package or Component

adb shell pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT

Set Default State for Package or Component

adb shell pm default-state [--user USER_ID] PACKAGE_OR_COMPONENT

Hide Package or Component

adb shell pm hide [--user USER_ID] PACKAGE_OR_COMPONENT

Unhide Package or Component

adb shell pm unhide [--user USER_ID] PACKAGE_OR_COMPONENT

Suspend Packages

adb shell pm suspend [--user USER_ID] PACKAGE [PACKAGE...]

Unsuspend Packages

adb shell pm unsuspend [--user USER_ID] PACKAGE [PACKAGE...]

Set Distracting Restriction

adb shell pm set-distracting-restriction [--user USER_ID] --flag hide-notifications
adb shell pm set-distracting-restriction [--user USER_ID] --flag hide-from-suggestions

Grant/Revoke Permission

adb shell pm grant [--user USER_ID] PACKAGE PERMISSION
adb shell pm revoke [--user USER_ID] PACKAGE PERMISSION

Set Permission Flags

adb shell pm set-permission-flags [--user USER_ID] PACKAGE PERMISSION [FLAGS..]

Clear Permission Flags

adb shell pm clear-permission-flags --user 0 PACKAGE PERMISSION review-required
adb shell pm clear-permission-flags --user 0 PACKAGE PERMISSION revoked-compat
adb shell pm clear-permission-flags --user 0 PACKAGE PERMISSION revoke-when-requested
adb shell pm clear-permission-flags --user 0 PACKAGE PERMISSION user-fixed
adb shell pm clear-permission-flags --user 0 PACKAGE PERMISSION user-set

Reset Permissions

adb shell pm reset-permissions

Set Permission Enforced

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

Get Privileged App Permissions

adb shell pm get-privapp-permissions TARGET-PACKAGE

Get Privileged App Deny Permissions

adb shell pm get-privapp-deny-permissions TARGET-PACKAGE

Get OEM Permissions

adb shell pm get-oem-permissions TARGET-PACKAGE

Trim Caches

adb shell pm trim-caches DESIRED_FREE_SPACE [internal|UUID]

List Users

adb shell pm list users

Create User

adb shell pm create-user [--profileOf USER_ID] [--managed] [--restricted] [--ephemeral] [--guest] [--pre-create-only] [--user-type USER_TYPE] USER_NAME

Remove User

adb shell pm remove-user [--set-ephemeral-if-in-use | --wait] USER_ID

Set User Restriction

adb shell pm set-user-restriction [--user USER_ID] RESTRICTION VALUE

Get Maximum Users

adb shell pm get-max-users

Get Maximum Running Users

adb shell pm get-max-running-users

Force Dex Optimization

adb shell pm force-dex-opt PACKAGE

Delete Dexopt

adb shell pm delete-dexopt PACKAGE

Background Dexopt Job

adb shell pm bg-dexopt-job

Cancel Background Dexopt Job

adb shell pm cancel-bg-dexopt-job

Reconcile Secondary Dex Files

adb shell pm reconcile-secondary-dex-files TARGET-PACKAGE

Dump Profiles

adb shell pm dump-profiles [--dump-classes-and-methods] TARGET-PACKAGE

Snapshot Profile

adb shell pm snapshot-profile TARGET-PACKAGE [--code-path path]

Set Home Activity

adb shell pm set-home-activity [--user USER_ID] TARGET-COMPONENT

Set Installer

adb shell pm set-installer PACKAGE INSTALLER

Get Instant App Resolver

adb shell pm get-instantapp-resolver

Set Harmful App Warning

adb shell pm set-harmful-app-warning [--user <USER_ID>] <PACKAGE> [<WARNING>]

Get Harmful App Warning

adb shell pm get-harmful-app-warning [--user <USER_ID>] <PACKAGE>

Uninstall System Updates

adb shell pm uninstall-system-updates [<PACKAGE>]

Get Module Info

adb shell pm get-moduleinfo [--all | --installed] [module-name]

Log Visibility

Enable Log Visibility

adb shell pm log-visibility --enable <PACKAGE>

Disable Log Visibility

adb shell pm log-visibility --disable <PACKAGE>
Status Meaning
none Nothing has been recorded for this domain
verified The domain has been successfully verified
approved Force approved, usually through shell
denied Force denied, usually through shell
migrated Preserved verification from a legacy response
restored Preserved verification from a user data restore
legacy_failure Rejected by a legacy verifier, unknown reason
system_configured Automatically approved by the device config
>= 1024 Custom error code which is specific to the device verifier
adb shell pm get-app-links [--user <USER_ID>] [<PACKAGE>]
State Description
STATE_NO_RESPONSE (0) Reset the domains as if no response was ever recorded.
STATE_SUCCESS (1) Treat the domains as successfully verified by the domain verification agent. Note that the domain verification agent can override this.
STATE_APPROVED (2) Treat the domains as always approved, preventing the domain verification agent from changing them.
STATE_DENIED (3) Treat the domains as always denied, preventing the domain verification agent from changing them.

You can use the following command to set the app links state for all domains:

adb shell pm set-app-links [--package <PACKAGE>] <STATE> all
adb shell pm reset-app-links [--user <USER_ID>] [<PACKAGE>]
adb shell pm verify-app-links [--re-verify] [<PACKAGE>]
adb shell pm set-app-links-user-selection --user <USER_ID> [--package <PACKAGE>] <ENABLED> <DOMAINS>...
adb shell pm set-app-links-allowed --user <USER_ID> [--package <PACKAGE>] <ALLOWED> <ENABLED> <DOMAINS>...
adb shell pm get-app-link-owners [--user <USER_ID>] [--package <PACKAGE>] [<DOMAINS>]