android pm 命令总结

文章出处:http://blog.csdn.net/shift_wwx

跟am命令一样,它的源码为位于frameworks/base/cmds/pm.

 

pm <command>

Command Description
list packages [options] <FILTER> Prints all packages, optionally only those whose package name contains the text in<FILTER>.

Options:

  • -f: See their associated file.
  • -d: Filter to only show disabled packages.
  • -e: Filter to only show enabled packages.
  • -s: Filter to only show system packages.
  • -3: Filter to only show third party packages.
  • -i: See the installer for the packages.
  • -u: Also include uninstalled packages.
  • --user <USER_ID>: The user space to query.

list permission-groups Prints all known permission groups.
list permissions [options] <GROUP> Prints all known permissions, optionally only those in <GROUP>.

Options:

  • -g: Organize by group.
  • -f: Print all information.
  • -s: Short summary.
  • -d: Only list dangerous permissions.
  • -u: List only the permissions users will see.

list instrumentation List all test packages.

Options:

  • -f: List the APK file for the test package.
  • <TARGET_PACKAGE>: List test packages for only this app.

list features Prints all features of the system.
list libraries Prints all the libraries supported by the current device.
list users Prints all users on the system.
path <PACKAGE> Print the path to the APK of the given <PACKAGE>.
install [options] <PATH> Installs a package (specified by <PATH>) to the system.

Options:

  • -l: Install the package with forward lock.
  • -r: Reinstall an exisiting app, keeping its data.
  • -t: Allow test APKs to be installed.
  • -i <INSTALLER_PACKAGE_NAME>: Specify the installer package name.
  • -s: Install package on the shared mass storage (such as sdcard).
  • -f: Install package on the internal system memory.
  • -d: Allow version code downgrade.

uninstall [options] <PACKAGE> Removes a package from the system.

Options:

  • -k: Keep the data and cache directories around after package removal.

clear <PACKAGE> Deletes all data associated with a package.
enable <PACKAGE_OR_COMPONENT> Enable the given package or component (written as "package/class").
disable <PACKAGE_OR_COMPONENT> Disable the given package or component (written as "package/class").
disable-user [options] <PACKAGE_OR_COMPONENT>

Options:

  • --user <USER_ID>: The user to disable.

grant <PACKAGE_PERMISSION> Grant permissions to applications. Only optional permissions the application has declared can be granted.
revoke <PACKAGE_PERMISSION> Revoke permissions to applications. Only optional permissions the application has declared can be revoked.
set-install-location <LOCATION> Changes the default install location. Location values:
  • 0: Auto—Let system decide the best location.
  • 1: Internal—install on internal device storage.
  • 2: External—install on external media.

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

get-install-location Returns the current install location. Return values:
  • 0 [auto]: Lets system decide the best location
  • 1 [internal]: Installs on internal device storage
  • 2 [external]: Installs on external media
set-permission-enforced <PERMISSION> [true|false] Specifies whether the given permission should be enforced.
trim-caches <DESIRED_FREE_SPACE> Trim cache files to reach the given free space.
create-user <USER_NAME> Create a new user with the given <USER_NAME>, printing the new user identifier of the user.
ove-user <USER_ID> Remove the user with the given <USER_IDENTIFIER>, deleting all data associated with that user
get-max-users Prints the maximum number of users supported by the device.
   

你可能感兴趣的:(android,命令,PM,am)