This is my private cheatsheet for ADB that I have decided to share since there is few good wikis for adb out there that has all in one place, so hopefully someone will enjoy this repo.
I wont include adb shell in any of my commands since I working on the device and not via shell I dont want to include adb shell. For all who prefering to work via a terminal like powershell or terminal just add "adb shell" infront of the commands.
First thing I want to mention since it seems very few people know that you can use below variables, so from now you you don t need to figoure out where your storage is:
ls \$EXTERNAL_STORAGE # View content
ls \$SECONDARY_STORAGE # View content
echo \$EXTERNAL_STORAGE # View path
echo \$SECONDARY_STORAGE # View path
adb start-server
adb stop-server
adb kill-server
adb tcpip <port>
adb connect <device_ip>
adb usb
adb reboot
reboot recovery
reboot bootloader
adb devices
adb get-state
adb get-serialno
adb backup -all
adb restore /path/to/backupflile.adb
adb shell
adb -s <id_from_adb_devices> shell
adb get-serialno
adb bugreport
adb install <apk_file>
adb install -r <apk_file>
adb uninstall <apk_file>
date MMDDYYYY.XX;am broadcast -a android.intent.action.TIME_SET
push mypicture.png /storage/on/device
push myfolder /storage/on/device
adb pull /storage/on/device/mypicture.png /path/on/pc
adb pull /storage/on/device /path/on/pc
adb pull /storage/on/device/ /path/on/pc # Notice the trial slash
pm list packages
pm list packages -e
pm list packages -d
pm list packages -3
pm list users
pm list permission-groups
pm list features
pm uninstall --user 0 com.package.name
for packages in com.package1 com.package2; do
adb shell pm uninstall --user 0 "${packages}"
done
pm clear PACKAGE_NAME
pm list permission-groups
pm list instrumentation
pm grant com.application android.permission.READ_LOGS
pm revoke com.application android.permission.READ_LOGS
pm reset-permissions -p your.app.package
- V — Verbose (lowest priority)
- D — Debug
- I — Info (default priority)
- W — Warning
- E — Error
- F — Fatal
- S — Silent (highest priority, on which nothing is ever printed)
adb logcat -v time ...
adb logcat -v threadtime ....
adb logcat ... -v color
adb logcat -g
adb logcat -G 16M
adb logcat -c
adb logcat *:V
adb logcat -f <filename> Dumps to specified file
adb logcat -v process
adb logcat -v raw
adb logcat -v time
adb logcat -v thread
Display the date, invocation time, priority, tag, and the PID and TID of the thread issuing the message
adb logcat -v threadtime
adb logcat -v long
adb logcat -b main -b radio -b events
dumpsys -l |sed 's/^ / /g'
Currently running services:
AAS
AODManagerService
CCM
CocktailBarService
CodecSolution
CustomFrequencyManagerService
DeviceRootKeyService
DirEncryptService
DisplaySolution
DockObserver
EngineeringModeService
HqmManagerService
ImsBase
OcfKeyService
ReactiveService
SEAMService
SamsungKeyProvisioningManagerService
SatsService
SecExternalDisplayService
...................
dumpsys bluetooth_manager
Settings are sorted for root and user:
GLOBAL SETTINGS (user 0)
SECURE SETTINGS (user 0)
SYSTEM SETTINGS (user 0)
SECURE SETTINGS (user 95)
SYSTEM SETTINGS (user 95)
dumpsys settings
_id:225 name:lock_screen_show_notifications pkg:com.android.settings value:1 default:1 defaultSystemSet:true
_id:6 name:volume_bluetooth_sco pkg:android value:7 default:7 defaultSystemSet:true
_id:192 name:ringtone_set pkg:com.google.android.gsf value:1
_id:159 name:lock_screen_allow_rotation pkg:android value:0 default:0 defaultSystemSet:true
_id:2997 name:Flashlight_brightness_level pkg:com.android.systemui value:1001 default:1001 defaultSystemSet:true
_id:67 name:SEM_VIBRATION_NOTIFICATION_INTENSITY pkg:android value:5 default:5 defaultSystemSet:true
_id:175 name:call_popup pkg:android value:0 default:0 defaultSystemSet:true
_id:59 name:install_non_market_apps pkg:android value:1 default:1 defaultSystemSet:true
.....
dumpsys simphonebook
dumpsys hardware_properties
****** Dump of HardwarePropertiesManagerService ******
CPU temperatures: [38.0, 38.0]
CPU throttling temperatures: [55.0, 76.0]
CPU shutdown temperatures: [115.0, 115.0]
dumpsys account|grep -i com.*$ -o|cut -d' ' -f1|cut -d} -f1|grep -v com$
com.microsoft.workaccount
com.skype.raider
com.samsung.android.mobileservice
com.facebook.messenger
com.google.android.gm.exchange
.......
dumpsys notification
dumpsys | grep -E -o "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b"
dumpsys package com.lge.signboard | grep versionName
versionName=6.00.170603-0
dumpsys user
...
State: RUNNING_UNLOCKED
...
Last logged in fingerprint
.....
agree Knox Privacy Policy: false
adb shell dumpsys battery
adb shell dumpsys batterystats
dumpsys batterystats --reset
dumpsys meminfo
Applications Memory Usage (in Kilobytes):
Uptime: 29602806 Realtime: 57806941
Total PSS by process:
265,435K: com.android.systemui (pid 4190)
264,671K: system (pid 3838)
171,192K: surfaceflinger (pid 3360)
152,523K: [email protected] (pid 3338)
128,781K: com.sec.android.app.launcher (pid 5597 / activities)
92,656K: se.kronansapotek.kronan (pid 26729 / activities)
84,563K: logd (pid 3203)
80,944K: com.google.android.talk (pid 32314 / activities)
79,754K: com.google.android.googlequicksearchbox:search
dumpstate -v
========================================================
== dumpstate: 2019-08-30 19:31:05
========================================================
Build: PPR1.180610.011.G950FXXS5DSF1
Build fingerprint: 'samsung/dreamltexx/dreamlte:9/PPR1.180610.011/G950FXXS5DSF1:user/release-keys'
Bootloader: G950FXXS5DSF1
Radio: G950FXXS5DSF1
Network: Comviq
Linux version 4.4.111-16019454 (dpi@21DHA724) (gcc version 4.9.x 20150123 (prerelease) (GCC) ) #1 SMP PREEMPT Mon Jun 3 20:16:50 KST 2019
Kernel: Command line: (unknown)
up 0 weeks, 0 days, 16 hours, 21 minutes
Uptime: Bugreport format version: 2.0
Dumpstate info: id=0 pid=26940 dry_run=0 args=dumpstate -v extra_options=
am broadcast -a android.intent.action.MASTER_CLEAR
am start -a android.intent.action.VIEW \
am start -n com.android.settings/com.android.settings.Settings
am start -a android.intent.action.INSERT content://telephony/carriers --ei simId
su -c "am broadcast -a android.provider.Telephony.SECRET_CODE -d android_secret_code://IOTHIDDENMENU"
am start -a android.intent.action.VIEW -d <url> (com.android.browser | com.android.chrome | com.sec.android.sbrowser)
am start -a com.android.settings/.wifi.CaptivePortalWebViewActivity
am start -a android.media.action.IMAGE_CAPTURE
am start -a android.media.action.VIDEO_CAMERA
am start -a android.intent.action.SET_WALLPAPER
am start -a android.intent.action.VIEW -d https://github.com/wuseman
am start -a android.intent.action.VIEW -d "geo:46.457398,-119.407305"
am start --ez show_night_mode true com.android.systemui/.tuner.TunerActivity
am broadcast -a com.whereismywifeserver.intent.TEST --es sms_body "test from adb"
am set-inactive <packageName>
am set-inactive <packageName> false
am start -a android.intent.action.VIEW -d facebook://facebook.com/inbox
am start -a android.intent.action.VIEW -d file:///sdcard/me.vcard -t text/x-vcard
am start -a android.intent.action.GET_CONTENT -t image/jpeg
aam broadcast -a com.whereismywifeserver.intent.TEST --es sms_body "test from adb"
content insert --uri content://settings/secure --bind name:s:user_setup_complete --bind value:s:1
There is to much to describe here, get info by type getprop, but you can for example grep various stuff by:
getprop | grep "model\|version.sdk\|manufacturer\|hardware\|platform\|revision\|serialno\|product.name\|brand"
am start -a android.settings.APPLICATION_DETAILS_SETTINGS package:<com.package.example>
content insert –uri content://settings/system –bind name:s:accelerometer_rotation –bind value:i:1
content insert –uri content://settings/system –bind name:s:accelerometer_rotation –bind value:i:0
content insert —uri content://settings/system –bind name:s:user_rotation –bind value:i:1
content insert –uri content://settings/system –bind name:s:user_rotation –bind value:i:0
keytool -exportcert -alias your_alias -keystore debug.keystore | openssl sha1 -binary | openssl base64
keytool -list -v -keystore ~/.android/debug.keystore -alias your_alia
wm size
wm size WxH
wm overscan 0,0,0,200
dumpsys window windows | grep -E 'mCurrentFocus|mFocusedApp'|grep '/'|awk -F'u0' '{print $2}'|awk '{print $1}'
dumpsys notification | grep NotificationRecord | wc -l
input swipe 0 0 0 300
input swipe 300 1000 300 500
Test any app by pressing 10000 times at once, this will start your application and perform 10000 random events.#
monkey -p com.example.myapp -v 10000
pm list packages | sed -e "s/package://" | while read x; do cmd package resolve-activity --brief $x | tail -n 1 | grep -v "No activity found";done
com.google.android.youtube/.app.honeycomb.Shell$HomeActivity
com.google.android.googlequicksearchbox/.SearchActivity
com.google.android.apps.docs.editors.docs/com.google.android.apps.docs.app.NewMainProxyActivity
com.android.documentsui/.LauncherActivity
com.google.android.apps.docs.editors.sheets/com.google.android.apps.docs.app.NewMainProxyActivity
com.google.android.apps.docs.editors.slides/com.google.android.apps.docs.app.NewMainProxyActivity
com.android.vending/.AssetBrowserActivity
.....
am start com.huawei.android.projectmenu/com.huawei.android.projectmenu.ProjectMenuActivity
dumpsys battery unplug
TZ=UTC date -d@$(cut -d\ -f1 /proc/uptime) +'%j %T' | awk '{print $1-1"d",$2}'
am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name "$(dialog --stdout --inputbox 'wuseman' 0 0)" -e postal "$(dialog --stdout --inputbox 'Postal Address' 0 0)" -e phone "$(dialog --stdout --inputbox 'Phone Number' 0 0)" -e email "$(dialog --stdout --inputbox 'Email' 0 0)"
am start -a android.intent.action.INSERT -t vnd.android.cursor.dir/contact -e name 'wuseman' -e phone <phone_number>
getprop sys.oem_unlock_allowed
getprop sys.boot_completed
thinkpad /home/wuseman # fastboot getvar all
(bootloader) version:0.5
(bootloader) variant:MTP eMMC
(bootloader) secure:yes
(bootloader) version-baseband:
(bootloader) version-bootloader:
(bootloader) display-panel:
(bootloader) off-mode-charge:0
(bootloader) charger-screen-enabled:0
(bootloader) max-download-size: 0x20000000
(bootloader) partition-type:cache:ext4
(bootloader) partition-size:cache: 0x20000000
(bootloader) partition-type:userdata:ext4
(bootloader) partition-size:userdata: 0x5ba000000
(bootloader) partition-type:system:ext4
(bootloader) partition-size:system: 0x15d800000
(bootloader) dm_count:0
(bootloader) lock_count:1
(bootloader) unlock_count:2
(bootloader) serialno:LGH87011067135
(bootloader) kernel:lk
(bootloader) product:MSM8996
(bootloader) unlocked:yes
fastboot erase config
fastboot reboot
fastboot oem get-psid #_Print_Serial_and_IMEI
fastboot getvar rescue_version #_Print_rescue_mode
fastboot getvar rescue_phoneinfo #_Print_phone_model
fsatboot getvar_vendorcountry #_Print_vendorcountry
fastboot getvar rescue_ugs_port #_Print_rescue_ugs_port
fastboot getvar rescue_enter_recovery #_Enter_recovery
fastboot getvar max-download-size #_Print_max_download_size
fastboot getvar error_print #_Print_amount_of_errors
fastboot getvar partition-type #_Print_partition_type
fastboot oem get_key_version #_Print_version_key
fastboot oem battery_present_check #_Print_battery_millivolt
fastboot continue #_Fastboot_continue
fastboot oem get_hwnff_ver #_Get_hwnff_version
fastboot oem reboot_boot_dump # UNKNOWN
fastboot getvar rescue_version # Print rescue version
fastboot getvar rescue_phoneinfo # Print rescue model
fastboot getvar devicemodel # Print device model
fastboot getvar rescue_ugs_port # Print rescue port
fastboot getvar error_print # Error Print
fastboot getvar rescue_enter_recovery # Enter recover
fastboot getvar rescue_get_hwid # (bootloader) xxxxxxxxxxxx / xxxxxxxxxxxx (bootloader)
fastboot getvar inject_bootfail_memory_address # NO DESCRIPTION - FOUND WHEN I CRACKED THE BOOTLOADER
fastboot getvar rescue_get_updatetoken # NO DESCRIPTION - FOUND WHEN I CRACKED THE BOOTLOADER
fastboot getvar max-download-size # NO DESCRIPTION - FOUND WHEN I CRACKED THE BOOTLOADER
fastboot oem check-rootinfo # NO DESCRIPTION - FOUND WHEN I CRACKED THE BOOTLOADER
fastboot oem get-bootinfo # NO DESCRIPTION - FOUND WHEN I CRACKED THE BOOTLOADER
fastboot oem get-product-model # NO DESCRIPTION - FOUND WHEN I CRACKED THE BOOTLOADER
fastboot oem get-build-number # NO DESCRIPTION - FOUND WHEN I CRACKED THE BOOTLOADER
fastboot oem unlock
fastboot oem check-image
fastboot oem relock
fastboot oem frp-unlock
fastboot oem get_key_version
fastboot oem battery_present_check
fastboot oem unlock_func
fastboot oem get_hwnff_ver
fastboot getvar error_print
fastboot oem oeminforead
fastboot oem get_bootFail_ver_func
fastboot oem func
fastboot oem get_bootFail_info_func
fastboot oem relock_func
fastboot oem reboot_boot_dump_func
fastboot oem hwdog certify begin
fastboot oem get-product-model
fastboot oem get-build-number
fastboot oem get_hwnff_ver_func
fastboot flashing unlock
cat /sys/devices/soc0/hw_platform
http://tjtech.me/analyze-oem-unlocking-under-android.html