27种用法格式 :
- pm list packages [-f] [-d] [-e] [-s] [-3] [-i] [-u] [--user USER_ID] [FILTER] 列出所有包名
- pm list permission-groups
- pm list permissions [-g] [-f] [-d] [-u] [GROUP]
- pm list instrumentation [-f] [TARGET-PACKAGE]
- pm list features
- pm list libraries
- pm list users
- pm path PACKAGE 列出包名对应的APK文件
- pm dump PACKAGE
- pm install [-l] [-r] [-t] [-i INSTALLER_PACKAGE_NAME] [-s] [-f] [--algo <algorithm name> --key <key-in-hex> --iv <IV-in-hex>] [--originating-uri <URI>] [--referrer <URI>] PATH 安装APP
- pm uninstall [-k] PACKAGE 卸载APP
- pm clear [--user USER_ID] PACKAGE 清除数据(不删除APP)
- pm enable [--user USER_ID] PACKAGE_OR_COMPONENT
- pm disable [--user USER_ID] PACKAGE_OR_COMPONENT
- pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT
- pm disable-until-used [--user USER_ID] PACKAGE_OR_COMPONENT
- pm block [--user USER_ID] PACKAGE_OR_COMPONENT
- pm unblock [--user USER_ID] PACKAGE_OR_COMPONENT
- pm grant PACKAGE PERMISSION
- pm revoke PACKAGE PERMISSION
- pm set-install-location [0/auto] [1/internal] [2/external]
- pm get-install-location
- pm set-permission-enforced PERMISSION [true|false]
- pm trim-caches DESIRED_FREE_SPACE
- pm create-user USER_NAME
- pm remove-user USER_ID 按用户ID删除用户
- pm get-max-users
用法说明:
1、pm list packages: prints all packages, optionally only those whose package name contains the text in FILTER. Options:
- -f: see their associated file. 同时显示apk文件所在位置
- -d: filter to only show disbled 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.
例子:列出系统中所有packages
root@S920:/ # pm list packagespackage:com.android.defcontainerpackage:com.lenovo.videoplayerpackage:com.UCMobilepackage:com.sohu.newsclientpackage:com.lenovo.gameworldphonepackage:com.lenovo.lasf.ttspackage:com.mediatek.voiceunlockpackage:com.mediatek.lbs.em...root@S920:/ # pm list packages -fpackage:/system/priv-app/DefaultContainerService.apk=com.android.defcontainerpackage:/system/app/LenovoVideoPlayer.apk=com.lenovo.videoplayerpackage:/system/vendor/operator/app/UCBrowser.apk=com.UCMobilepackage:/system/vendor/operator/app/SohuNews.apk=com.sohu.newsclientpackage:/system/priv-app/GameWorld_Phone.apk=com.lenovo.gameworldphonepackage:/system/priv-app/LeVoiceLasfTts.apk=com.lenovo.lasf.ttspackage:/system/app/VoiceUnlock.apk=com.mediatek.voiceunlockpackage:/system/app/LocationEM.apk=com.mediatek.lbs.em... root@S920:/ # pm list packages media (只显示包名中含有media字符的)package:com.mediatek.voiceunlockpackage:com.mediatek.lbs.empackage:com.mediatek.voicecommandpackage:com.mediatek.mtkloggerpackage:com.android.providers.mediapackage:com.mediatek.connectivitypackage:com.mediatek.batterywarningpackage:com.mediatek.thermalmanagerpackage:com.mediatek.calendarimporter
2、pm list permission-groups: prints all known permission groups.
例子:
root@S920:/ # pm list permission-groupspermission group:android.permission-group.DEVELOPMENT_TOOLSpermission group:android.permission-group.CALENDARpermission group:com.sina.weibo.permission-grouppermission group:android.permission-group.AFFECTS_BATTERYpermission group:android.permission-group.STATUS_BARpermission group:android.permission-group.DISPLAYpermission group:android.permission-group.CAMERA...
3、pm list permissions: 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.
例子:列出系统所有许可
root@S920:/ # pm list permissionsAll Permissions:permission:com.tencent.photos.permission.DATApermission:com.lenovo.leos.appstore.permission.APP_COMMENTSpermission:com.lenovo.safecenter.permission.RemoteHealthCheckpermission:android.permission.INTERNAL_SYSTEM_WINDOWpermission:android.permission.MOVE_PACKAGEpermission:android.permission.CONTROL_WIFI_DISPLAYpermission:android.permission.READ_INPUT_STATEpermission:com.uapush.android.permission.SENDpermission:android.permission.GET_TOP_ACTIVITY_INFOpermission:android.permission.REBOOTpermission:com.tencent.msg.permission.pushnotifypermission:android.permission.FILTER_EVENTSpermission:android.permission.STATUS_BARpermission:android.permission.ACCESS_DOWNLOAD_MANAGER_ADVANCEDpermission:android.permission.STOP_APP_SWITCHES...
4、pm list instrumentation: use to list all test packages; optionally supply <TARGET-PACKAGE> to list the test packages for a particular application. Options:
-f: list the .apk file for the test package.
5、pm list features: prints all features of the system.
例子:列出所有手机特性
root@S920:/ # pm list featuresfeature:reqGlEsVersion=0x20000feature:android.hardware.bluetoothfeature:android.hardware.bluetooth_lefeature:android.hardware.camerafeature:android.hardware.camera.anyfeature:android.hardware.camera.autofocusfeature:android.hardware.camera.flashfeature:android.hardware.camera.frontfeature:android.hardware.faketouchfeature:android.hardware.locationfeature:android.hardware.location.gpsfeature:android.hardware.location.networkfeature:android.hardware.microphonefeature:android.hardware.screen.landscapefeature:android.hardware.screen.portraitfeature:android.hardware.sensor.accelerometerfeature:android.hardware.sensor.compassfeature:android.hardware.sensor.gyroscopefeature:android.hardware.sensor.lightfeature:android.hardware.sensor.proximityfeature:android.hardware.telephonyfeature:android.hardware.telephony.gsmfeature:android.hardware.touchscreenfeature:android.hardware.touchscreen.multitouchfeature:android.hardware.touchscreen.multitouch.distinctfeature:android.hardware.touchscreen.multitouch.jazzhandfeature:android.hardware.usb.accessoryfeature:android.hardware.usb.hostfeature:android.hardware.wififeature:android.hardware.wifi.directfeature:android.software.app_widgetsfeature:android.software.device_adminfeature:android.software.home_screenfeature:android.software.input_methodsfeature:android.software.live_wallpaperfeature:android.software.sipfeature:android.software.sip.voipfeature:com.lenovo.akgservicefeature:com.lenovo.framework.ziptheme.supportfeature:com.lenovo.theme.editorfonttypeface
6、pm list users: prints all users on the system.
例子:
root@S920:/ # pm list usersUsers: UserInfo{0:机主:13}
7、pm path: print the path to the .apk of the given PACKAGE.
例子:按包名查找apk文件所在路径
手机打开APProot@S920:/ # dumpsys window | grep mCurrentFocus mCurrentAppOrientation=1 mCurrentFocus=Window{42b56e48 u0 com.lenovo.videotalk.phone/com.lenovo.vctl.weaver.phone.activity.WeaverRoot}root@S920:/ # pm path com.lenovo.videotalk.phonepackage:/system/priv-app/Youyue.apk
8、pm dump: print system state associated with the given PACKAGE.
9、pm install: installs a package to the system. Options:
- -l: install the package with FORWARD_LOCK.
- -r: reinstall an exisiting app, keeping its data. 覆盖安装APP,保留原数据
- -t: allow test .apks to be installed.
- -i: specify the installer package name.
- -s: install package on sdcard. 安装在sdcard上
- -f: install package on internal flash. 安装在内部flash上
- -d: allow version code downgrade. 允许降级安装
例子:
安装方法一:c:\tmp\fastboot>adb install c:/tmp/SystemApp_Remove.apkPerforming Push Installc:/tmp/SystemApp_Remove.apk: 1 file pushed. 0.7 MB/s (211231 bytes in 0.293s) pkg: /data/local/tmp/SystemApp_Remove.apkSuccess安装方法二:c:\tmp\fastboot>adb push c:/tmp/SystemApp_Remove.apk /sdcard/c:/tmp/SystemApp_Remove.apk: 1 file pushed. 1.4 MB/s (211231 bytes in 0.147s)c:\tmp\fastboot>adb shellroot@S920:/ # suroot@S920:/ # pm install -r /sdcard/SystemApp_Remove.apk pkg: /sdcard/SystemApp_Remove.apkSuccess
10、pm uninstall: removes a package from the system. Options:
-k: keep the data and cache directories around after package removal. 保留数据
例子:
root@S920:/ # pm uninstall -- user 0 com.iyd.reader.ReadingJoyFailure
11、pm clear: deletes all data associated with a package..
例子:只删除数据
root@S920:/ # dumpsys window | grep mCurr mCurrentAppOrientation=1 mCurrentFocus=Window{42bd2f90 u0 com.lenovo.videotalk.phone/com.lenovo.vctl.weaver.phone.activity.WeaverRoot}root@S920:/ # pm path com.lenovo.videotalk.phonepackage:/system/priv-app/Youyue.apkroot@S920:/ # pm clear com.lenovo.videotalk.phoneSuccess
12、pm enable, disable, disable-user, disable-until-used: these commands change the enabled state of a given package or component (written as "package/class").
13、pm grant, revoke: these commands either grant or revoke permissions to applications. Only optional permissions the application has declared can be granted or revoked.
14、pm get-install-location: returns the current install location.
- 0 [auto]: Let system decide the best location
- 1 [internal]: Install on internal device storage
- 2 [external]: Install on external media
15、pm set-install-location: changes the default install location.
NOTE: this is only intended for debugging; using this can cause applications to break and other undersireable behavior.
- 0 [auto]: Let system decide the best location
- 1 [internal]: Install on internal device storage
- 2 [external]: Install on external media
16、pm trim-caches: trim cache files to reach the given free space.
17、pm create-user: create a new user with the given USER_NAME, printing the new user identifier of the user. 创建新用户
18、pm remove-user: remove the user with the given USER_IDENTIFIER, deleting all data associated with that user 。 按用户ID删除用户
版权声明:内容来源于互联网和用户投稿 如有侵权请联系删除