Pm
Package Manage
PM list packages [FILTER] to view installed app packages
-F Show Associated APK file
-S only searches the system application for filter
3 Search filter only in third-party apps
-D only in disabled package search filter
-e only in the enabled package search filter
-I display Installer
-U uninstalled Package
--user USERID
PM list instrumentation [target-package] Show all test packages
-F Show Associated APK file
PM List Features
PM List permission-groups
PM List permissions [GROUP]
-G organized by group
-F Show All information
-S Display Brief
-D Show Only Dangerous permissions
-U displays only the user-visible
PM List Users
PM Uninstall <package>
-K preserving data and caching
PM Clear <package> Clear Data
--user USERID
PM Path <package> View APK package path for an app
PM Dump <package> Display System status information related to the package
PM Install PATH
-L Forward_lock
-R Reinstall, keep data
-T run install test APK
-I specify the installation package name
-S SDcard
-F Internal Memory
-D Allow version demotion
PM Get-install-location return to the current default installation location
return value:
0 Auto
1 Internal Storage
2 external Storage
PM Set-install-location 0|1|2 Modify the default installation location,
PM Enable|disable|disable-user|disable-until-used|block|unblock [--user USERID] Package_or_component
PM Grant|revoke Package PERMISSION app Add and subtract permissions (must already be declared in app)
PM Create-user User_name
PM Remove-user user_id
PM Get-max-users
PM set-permission-enforced permission [True|false]
PM Trim-caches desired_free_space
Am
Activity Manage
Common options
--user <USER_ID> | Current | All run with a specific user
Am start [options] <INTENT> start activity
Options
-D Debug mode
-W wait for start end
--start-profilter <FILE> Startup Analyzer, output to file
-P <FILE> start Analyzer, output to file, stop analysis when idle is applied
-R <COUNT> repeatedly starts COUNT times, ending the top Activity before each repetition
-S force stop after start
--opengl-trace starting OpenGL function Records
--user <USER_ID> | current specifies which user to run, and the default is that the user
Am StartService <INTENT> Start-up service
Am StopService <INTENT> Stop Service
Am Force-stop <PACKAGE> forcibly stops everything related to the package
AM Kill <PACKAGE> Kill package-related processes
Am Kill-all kill all background processes
AM Broadcast <INTENT>
AM instrument [options] <COMPONENT>
Options
-R outputs the test results in its original form. This option is typically used with the- e perf True when performing a performance test
-P <FILE> output analysis data to file
-W <TEST_PACKAGE/RUNNER_CLASS> not return until instrumentation ends
--no-window-animation
--user <USER_ID> | Current
-e <testrunner_flag> <value>[,<value> ...]
Instrumentationtestrunner Flag Available
|
Package |
<full_java_package> |
Perform the tests in a Java package |
|
Class |
<full_class_name>
<full_class_name> #methos_name |
Execute a test class |
|
Func |
True |
Perform all instrumentationtestcase |
|
Unit |
True |
Perform non- instrumentationtestcase and non- performancetestcase test Classes |
|
Size |
Small|medium|large |
Run @SmallTest, @MediumTest, @LargeTest labeled Tests
The Android.test.annotation package defines @largetest, @MediumTest, @SmallTest, @Smoke, and @suppress |
|
Perf |
True |
Executive Performancetestcase with -r mates, output RAW format output |
|
Debug |
True |
Debug Mode Execution Test |
|
Log |
True |
|
<INTENT> specifications include these flags and arguments:
[-a <action>] [-D ] [-t <mime_type>] Android.intent.action.VIEW content://contacts/people/1 image/png
[-C <CATEGORY> [-C <category>] ...] Android.intent.category.APP_CONTACTS
[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]
[--esn <EXTRA_KEY> ...]
[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]
[--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]
[--el <EXTRA_KEY> <EXTRA_LONG_VALUE> ...]
[--ef <EXTRA_KEY> <EXTRA_FLOAT_VALUE> ...]
[--eu <EXTRA_KEY> <EXTRA_URI_VALUE> ...]
[--ECN <EXTRA_KEY> <extra_component_name_value>]
[--eia <EXTRA_KEY> <extra_int_value>[,<extra_int_value ...]
[--ela <EXTRA_KEY> <extra_long_value>[,<extra_long_value ...]
[--efa <EXTRA_KEY> <extra_float_value>[,<extra_float_value ...]
[-n <component>] [-f <flags>]
[--grant-read-uri-permission] [--grant-write-uri-permission]
[--debug-log-resolution] [--exclude-stopped-packages]
[--include-stopped-packages]
[--activity-brought-to-front] [--activity-clear-top]
[--activity-clear-when-task-reset] [--activity-exclude-from-recents]
[--activity-launched-from-history] [--activity-multiple-task]
[--activity-no-animation] [--activity-no-history]
[--activity-no-user-action] [--activity-previous-is-top]
[--activity-reorder-to-front] [--activity-reset-task-if-needed]
[--activity-single-top] [--activity-clear-task]
[--activity-task-on-home]
[--receiver-registered-only] [--receiver-replace-pending]
[--selector]
[<uri> | <PACKAGE> | <component>]
Dumpsys
Querying system services for system run-time state information
Source code: Https://android.googlesource.com/platform/frameworks/native/+/master/cmds/dumpsys/dumpsys.cpp
Dumpsys Display all service information without any parameters
Dumpsys | grep FILTER
Service List Display system service lists
Dumpsys Service [service_options] displays status information for specified services
Dumpsys Service-h Some services can see the parameters that can be accepted
For example:
Dumpsys Battery
Dumpsys WiFi
Dumpsys Cpuinfo
Dumpsys Meminfo
Dumpsys Meminfo Com.xracoon.wifisetter
Dumpsys Window W | grep mcurrentfocus
Debug Test
Dumpstate
Dmesg
Monkey [Options] Count
Screenrecord [Options] <file> android4.4+
Screencap-p <file>
Input
input [<source>] <command> [<arg> ...]
Source
Trackball, joystick, touchnavigation, mouse, keyboard, gamepad, Touchpad, Dpad, stylus, touchscreen
Command and/default source:
Text <string>/touchscreen
KeyEvent [--longpress] <key code number or name> .../keyboard
Tap <x> <y>/touchscreen
Swipe <x1> <y1> <x2> <y2> [Duration_ms]/touchscreen
Press/trackball
Roll <dx> <dy>/trackball
Android Shell Command Summary