General command

  1. The adb shell ps | grep -i find process information

  2. Adb shell getenforce adb shell setenforce 0 // Set it to permissive mode. Adb shell setenforce 1 // Set it to Enforce mode

  3. adb reboot edl adb reboot recovery adb reboot bootloader

  4. Adb Forward TCP :8888 TCP :9999 Forwards the data on port 8888 on the PC to port 9999 on the Android

Interaction between ADB and AM PM WM

Adb and AM start the activity/service/ broadcast

-a (action), -n(component)

  1. Broadcast the adb shell am broadcast – a * * * the adb shell am broadcast – a android. Intent. Action. BATTERY_CHANGED radio battery

  2. Start the activity the adb shell am start – a adb shell am start – a android. Intent. Action. CALL – d tel: 10086 adb shell start – n the adb shell am start -n org.codeaurora.gallery/com.android.gallery3d.app.GalleryActivity

  3. Adb shell am startService -n ADB shell am stopService

  4. Disable app ADB shell am force-stop adb shell am force-stop org.codeaurora.gallery

  5. Adb shell am help startup time Cold start, hot start

adb shell am start -W org.codeaurora.gallery/com.android.gallery3d.app.GalleryActivity

Adb shell Stack List Activity stack, Task and other concepts

Adb shell am profile start 17495 / MNT /sdcard/profile. TXT Prints the heap information of the specified process number to the specified file -n: Adb shell am Dumpheap-n 17495 / MNT /sdcard/dumpheap.txt

Adb shell am display-size 1280×800 ADB shell am display-density 480

The adb and PM

adb shell pm list packages

adb shell pm list features

adb shell pm list librarys

adb shell pm help

PM query classes

List packages: Lists all installed application packages (including system and user applications) in the device. List features: Lists all hardware related information; List libraries: Lists the liBs supported by the current device. List users: Lists all users on the system. List permissions: Lists all known permissions; List ‘pkgname’ : lists the associated file (APK archive file) of the specified package name; Path ‘pkgname’ : Query the installation location of the package.

PM action class

Install [-lrtsfd] [PATH] : install command; -l: Locks the application. -r: reinstalls the application and retains the application data. -i: specifies the name of the installation package. -s: The sd card is installed. -f: To be installed in the built-in storage (default installation location). -g: grants all permissions listed in the application manifest (available for system 6.0 only); Uninstall [options] ‘pkgname’ : uninstall command; -k: uninstalls the application and retains data and cache. (If -k is not added, all data and cache are deleted.) Clear ‘pkgname’ : deletes all data for the specified package; Enable ‘pkgname’ : make package or Component available. (e.g. PM enable “package/class”); Disable ‘pkgname’ : Makes package or Component unavailable. (e.g. PM disable “package/class”); Grant ‘pkgname’ to application; Revoke ‘pkgname’ : Revoke permissions; Set-install-location ‘location’ : sets the default installation location. 0: allows the system to automatically select the best installation position. 1: The device is installed into the internal storage space. 2: The device is installed to an external storage space. Get-install-location: Returns the current installation location. Return result as above parameter option; Create-user ‘USER_NAME’ : adds a new user; Remove-user ‘USER_ID’ : deletes a user.

The adb and wm

Window manager (window) commands: help Print this help text. size [reset|WxH|WdpxHdp] Return or override display size. width and height in pixels unless suffixed with ‘dp’. density [reset|DENSITY] Return or override display density. overscan [reset|LEFT,TOP,RIGHT,BOTTOM] Set overscan area for display. scaling [off|auto] Set display scaling mode. dismiss-keyguard Dismiss the keyguard, prompting user for auth if necessary. tracing (start | stop) Start or stop window tracing.

adb shell wm dismiss-keyguard

adb shell wm size

adb shell wm density

Adb dumpsys can dump what

PS E:\Users\Administrator\Desktop> adb shell dumpsys activity help

Activity manager dump options: [-a] [-c] [-p PACKAGE] [-h] [WHAT] … WHAT may be one of: a[ctivities]: activity stack state r[recents]: recent activities state b[roadcasts] [PACKAGE_NAME] [history [-s]]: broadcast state broadcast-stats [PACKAGE_NAME]: aggregated broadcast statistics i[ntents] [PACKAGE_NAME]: pending intent state p[rocesses] [PACKAGE_NAME]: process state o[om]: out of memory management perm[issions]: URI permission grant state prov[iders] [COMP_SPEC …] : content provider state provider [COMP_SPEC]: provider client-side state s[ervices] [COMP_SPEC …] : service state as[sociations]: tracked app associations settings: currently applied config settings service [COMP_SPEC]: service client-side state package [PACKAGE_NAME]: all state related to given package all: dump all activities top: dump the top activity WHAT may also be a COMP_SPEC to dump activities. COMP_SPEC may be a component name (com.foo/.myApp), a partial substring in a component name, a hex object identifier. -a: include all available server state. -c: include client state. -p: limit output to given package. –checkin: output checkin format, resetting data. –C: output checkin format, not resetting data. –proto: output dump in protocol buffer format. –autofill: dump just the autofill-related state of an activity Bad activity command, or no activities match: help Use -h for help.

Adb shell Dumpsys meminfo – Adb shell Dumpsys window ADB shell Dumpsys window displays adb shell Dumpsys window windows adb shell dumpsys power adb shell dumpsys battery adb shell dumpsys activity activities adb shell dumpsys activity services adb shell dumpsys activity top

adb shell settings

global /system/ security

adb shell settings put

adb shell settings get