当前位置: 首页 > 工具软件 > pm2Manage > 使用案例 >

android pm install apk,7.0 apk 安裝 (pm 命令)

唐俊英
2023-12-01

pm path [--user USER_ID] PACKAGE //查看apk安裝后位置

pm dump PACKAGE //打印給定的包的系統狀態

DUMP OF SERVICE package 打印服務信息

DUMP OF SERVICE activity 打印activity信息

DUMP OF SERVICE meminfo 打印當前內存使用信息

DUMP OF SERVICE procstats 打印系統內存使用與一段時間內存匯總

DUMP OF SERVICE usagestats 打印服務器使用狀態信息

DUMP OF SERVICE batterystats 打印電池狀態信息

pm install [-lrtsfd] [-i PACKAGE] [--user USER_ID] [PATH] //安裝應用 ---- 比較重要常用的

pm install-create [-lrtsfdp] [-i PACKAGE] [-S BYTES]

[--install-location 0/1/2]

[--force-uuid internal|UUID]

pm install-write [-S BYTES] SESSION_ID SPLIT_NAME [PATH]

pm install-commit SESSION_ID

pm install-abandon SESSION_ID

pm uninstall [-k] [--user USER_ID] PACKAGE // 卸載應用 ---- 比較重要常用的

pm set-installer PACKAGE INSTALLER

pm move-package PACKAGE [internal|UUID]

pm move-primary-storage [internal|UUID]

pm clear [--user USER_ID] PACKAGE

pm enable [--user USER_ID] PACKAGE_OR_COMPONENT //使package或component可用。(如:pm enable "package/class")

pm disable [--user USER_ID] PACKAGE_OR_COMPONENT //使package或component不可用。(如:pm disable "package/class")(disable了指定的package,但是getComponentEnabledSetting該package里的components依然是enable狀態的。disable-user一樣原理。)

pm disable-user [--user USER_ID] PACKAGE_OR_COMPONENT

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

pm default-state [--user USER_ID] PACKAGE_OR_COMPONENT

pm hide [--user USER_ID] PACKAGE_OR_COMPONENT //隱藏package或component

pm unhide [--user USER_ID] PACKAGE_OR_COMPONENT //恢復可見package或component

pm grant [--user USER_ID] PACKAGE PERMISSION //授予權限 授予應用權限許可。必需android6.0(API級別23)以上的設備

pm revoke [--user USER_ID] PACKAGE PERMISSION //撤銷權限 必需android6.0(API級別23)以上的設備

pm reset-permissions

pm set-app-link [--user USER_ID] PACKAGE {always|ask|never|undefined}

pm get-app-link [--user USER_ID] PACKAGE

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 [internal|UUID]

pm create-user [--profileOf USER_ID] [--managed] [--restricted] [--ephemeral] [--guest] USER_NAME

pm remove-user USER_ID //根據用戶id刪除用戶

pm remove-user://remove the user with the given USER_IDENTIFIER,

//deleting all data associated with that user

pm get-max-users // (Maximum supported users: 4) 備所支持的最大USER數

pm path PACKAGE://print the path to the .apk of the given PACKAGE.

pm dump PACKAGE://print system state associated with the given PACKAGE.

pm install PACKAGE//: install a single legacy package

pm install-create: create an install session

-l: forward lock application 鎖定應用程序 - 用的少

-r: replace existing application

-t: allow test packages

-i: specify the installer package name

-s: install application on sdcard

-f: install application on internal flash

-d: allow version code downgrade (debuggable packages only)

-p: partial application install

-g: grant all runtime permissions; // :授權給應用。

-S: size in bytes of entire session

pm install-write: write a package into existing session; path maybe '-' to read from stdin

-S: size in bytes of package, required for stdin

pm install-commit: perform install of fully staged session

pm install-abandon: abandon session

pm set-installer: set installer package name

pm uninstall [options] : removes a package from the system. Options:

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

pm clear : deletes all data associated with a package. 對指定的包進行刪除

//pm enable, disable, disable-user, disable-until-used, default-state:these commands change the enabled state of a given package or

//component (written as \"package/class\").

//pm grant, revoke: these commands either grant or revoke permissions to apps.

//The permissions must be declared as used in the app's

//manifest, be runtime permissions (protection level dangerous),

//and the app targeting SDK greater than Lollipop MR1.

pm reset-permissions: revert all runtime permissions to their default state.

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

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

pm trim-caches: trim cache files to reach the given free space.

pm create-user: create a new user with the given USER_NAME,

//printing the new user identifier of the user.

//NOTE: 'pm list' commands have moved! Run 'adb shell cmd package to display the new commands. 這個是在7.0 mtk 源碼中

pm list users //查看當前user

Users:

UserInfo{0:機主:13} running

android:icon="drable resource"

android:label="string resource"

android:name="string"

android:permissionGroup="string"

android:protectionLevel=["normal"|"dangerous"|"signature"|"signatureOrSystem"]/>

protectionLevel

normal 表示權限是低風險的,不會對系統,用戶或其他應用程序造成危害

dangerous 表示權限是高風險的,系統將可能要球用戶輸入相關信息,才會授予此權限

signature 表示只有當應用程序所用數字簽名與聲明引用權限的應用程序所用簽名相同時,才能將權限授予給它

signatureOrSystem 需要簽名或者系統級應用(放置在/system/app目錄下)才能賦予權限

system 系統級應用(放置在/system/app目錄下)才能賦予權限

自定義權限 應用自行定義的權限

pm list permission-groups :打印所有已知的權限群組。

pm list permissions [options] pm list permissions –g -d -u

-g 按組進行列出權限

-f 打印所有信息

-s 簡短的摘要

-d 只有危險的權限列表

-u 只有權限的用戶將看到列表

用戶自定義權限

pm list features//設備特性。硬件之類的性能。

pm list libraries//當前設備支持的libs。

pm list package// 顯示所有已經安裝的包名。

pm list package -f //也顯示associated文件所在目錄(即保存的APK文件)

 类似资料: