ADB Notes

Miscellaneous

1
2
3
4
5
6
7
8
adb reboot
adb reboot download
# uninstall package
adb uninstall com.my.firstapp
# power off
adb reboot -p
# erase user data, then reboot
adb shell recovery --wipe_data

Remove System App

1
2
3
adb root
adb remount
adb shell rm /system/priv-app/GoogleLoginService.apk

Root/Unroot

1
2
adb root
adb unroot

List Package

1
2
3
4
5
6
7
8
9
10
11
adb shell pm list packages
# list the package names as well as the path to the installed APK files
adb shell pm list packages -f
# list only the system packages
adb shell pm list packages -s
# list only 3rd party (or non-system) packages
adb shell pm list packages -3
# list all the disabled package names
adb shell pm list packages -d
# list all the enabled package names
adb shell pm list packages -e

Simulate Keyboard Input

1
2
3
adb shell input keyevent <event_code>
adb shell input text <string>
# KEYCODE_ENTER 66

UID Lookup

1
2
3
4
5
6
7
# package_name to uid
adb shell dumpsys package <package_name> |grep userId

# uid to package_name
adb shell dumpsys package | grep -A1 'userId=<uid>'
# or
adb shell cat /data/system/packages.list | grep <uid>

References

Android: ADB – List Installed Package Names
KeyEvent