pm包管理命令

pm 命令详解

pm即package manager,使用pm命令可以去模拟android行为或者查询设备上的应用信息等

list packages [-f] [-d] [-e] [-s] [-3] [-i] [-l] [-u] [-U]
[--show-versioncode] [--apex-only] [--uid UID] [--user USER_ID] [FILTER]
Prints all packages; optionally only those whose name contains
the text in FILTER. Options are:
-f: see their associated file
-a: all known packages (but excluding APEXes)
-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
-l: ignored (used for compatibility with older releases)
-U: also show the package UID
-u: also include uninstalled packages
--show-versioncode: also show the version code
--apex-only: only show APEX packages
--uid UID: filter to only show packages with the given UID
--user USER_ID: only list packages belonging to the given user

显示安装了多少应用

adb shell pm list packages

显示安装了多少系统应用

adb shell pm list packages -s | wc -l

显示安装了多少第三方应用

adb shell pm list packages -3

删除与包相关的所有数据:清除数据和缓存.相当于重新安装

adb shell pm clear com.xiya.radar.wifi

命令	功能	实现方法
dump	dump信息	AM.dumpPackageStateStatic
clear	清空App数据	AMS.clearApplicationUserData
uninstall [options]	卸载应用	IPackageInstaller.uninstall
force-dex-opt	dex优化	PMS.forceDexOpt
trim-caches <目标size>	紧缩cache目标大小	PMS.freeStorageAndNotify
list packages	列举app包信息	PMS.getInstalledPackages
get-install-location	获取安装位置	PMS.getInstallLocation
path	查看App路径	PMS.getPackageInfo
install [options]	安装应用	PMS.installPackageAsUser
hide	隐藏应用	PMS.setApplicationHiddenSettingAsUser
unhide	显示应用	PMS.setApplicationHiddenSettingAsUser
enable <包名或组件名>	enable	PMS.setEnabledSetting
disable <包名或组件名>	disable	PMS.setEnabledSetting
set-install-location	设置安装位置	PMS.setInstallLocation
get-max-users	最大用户数	UserManager.getMaxSupportedUsers
————————————————
原文链接:https://blog.csdn.net/Picasso_L/article/details/78683405
posted @ 2022-12-15 17:31  木子墨墨  阅读(435)  评论(0编辑  收藏  举报