The am pm command in the adb shell, some of your own opinions and translations on most official websites.
Let's talk about the am command, which is short for activity manager. You can use am to simulate various system behaviors, such as starting an activity, forcibly stopping the process, and sending broadcast processes, modify device screen properties. When you run the am command under the adb shell command:
Am <command>
You can also run the am command before the adb shell:
Adb shell am start-a android. intent. action. VIEW
Introduction to some am commands:
Start [options] <INTENT>: start an activity by using the specified intent parameter. For specific intent parameters, refer to the official table.
Startservice [options] <INTENT>: start the service using the specified intent parameter. The specific intent and start command parameters are the same.
Force-stop <PACKAGE>: force stop a specified package application.
Kill [options] <PACKAGE>: kill the application process of the specified package. This command kills the process in safe mode without affecting the user experience. Parameter options: -- user <USER_ID> | all | current: specify that the user process is killed. If this parameter is not specified, all users are killed by default. (We will introduce USER_ID below)
Kill-all: kill all background processes.
Broadcast [options] <INTENT>: Send an intent. For specific intent parameters, refer to the start command parameters. Parameter options: -- user <USER_ID> | all | current: specify that the user process is killed. If this parameter is not specified, all users are killed by default.
Instrument [options] <COMPONENT>: Test command, which is not described in detail.
Profile start <PROCESS> <FILE>: Run profile in the <PROCESS> PROCESS and write the analysis result to <FILE>.
Profile stop <PROCESS>: stop profile.
Set-debug-app [options] <PACKAGE>: set the package application to debug mode. Parameter options:-w | -- persistent: waiting to enter the debugging mode, retain the value.
Clear-debug-app: clear the package application set with the set-debug-app command.
Run the following command to view the official website:
Monitor [options]
Screen-compat [on | off] <PACKAGE>
Display-size [reset | <WxH>]
Display-density <dpi>
To-uri <INTENT>
To-intent-uri <INTENT>
Next we will introduce the pm command, which is full name of package manager. You can use the pm command to simulate android behaviors or query applications on the device. When you run the pm command under the adb shell command:
Pm <command>
You can also run the pm command before the adb shell:
Adb shell pm uninstall com. example. MyApp
Introduction to some pm commands:
List packages [options] <FILTER>: print all packages and select a list of packages. Parameter option:-f: view the associated file, that is, the location of the application apk and the corresponding package name (for example, package:/system/app/MusicPlayer.apk = com. sec. android. app. music);-d: View disabled packages;-e: View enable package;-s: view system package;-3: View third-party package;-I: check the installer (for example, package: com. tencent. qqmusic installer = null 2. package: com. tencent. qqpim installer = com. android. vending);-u: view the packages that have been uninstalled. (It will still be included after uninstallation and re-installation); -- user <USER_ID>: The user space to query.
List permission-groups: print all known permission groups.
List permissions [options] <GROUP>: select the print permission. Parameter options:
List features: device features. Performance of hardware.
List libraries: The libs supported by the current device.
List users: all users on the system. (The USER_ID query method mentioned above, for example: UserInfo {0: Primary: 3}, then USER_ID is 0)
Path <PACKAGE>: query the package installation location.
Install [options] <PATH>: Installation command.
Uninstall [options] <PACKAGE>: uninstall command.
Clear <PACKAGE>: deletes all data from the specified package.
Enable <PACKAGE_OR_COMPONENT>: Make the package or component available. (For example, pm enable "package/class ")
Disable <PACKAGE_OR_COMPONENT>: Make the package or component unavailable. (For example, pm disable "package/class ")
Disable-user [options] <PACKAGE_OR_COMPONENT>: Parameter options: -- user <USER_ID>: The user to disable.
Grant <PACKAGE_PERMISSION>: authorize the application.
Revoke <PACKAGE_PERMISSION>: revoke permissions.
Set-install-location <LOCATION>: set the default installation location. 0: the system automatically selects the best installation location. 1: Install it to the internal device storage space. 2: Install it to an external device storage space. (This is only used to debug the application. Using this command may cause the application to exit or cause other discomfort ).
Get-install-location: returns the current installation location. The returned result is the same as the preceding parameter.
Set-permission-enforced <PERMISSION> [true | false]: enable or disable the specified permission.
Create-user <USER_NAME>: Add a new USER.
Remove-user <USER_ID>: delete a USER.
Get-max-users: Maximum number of users supported by the device. (Some devices do not support this command)