Printable. Tables and commands only. Full explanations live in README.md.
Baseline: Android 13–16 (API 33–36). Historical behaviour marked in the Since / Until columns.
Legend for code fences: # host = your workstation, # adb shell = unprivileged device shell
(shell user, uid 2000), # adb shell (root) = adb root or su, # Frida REPL = inside Frida.
# adb shell — the five facts you always want firstp=com.example.app
pmpath$p
pmlistpackages-U|grep-w"package:$p"
dumpsyspackage$p|grep-E'userId=|dataDir=|primaryCpuAbi=|versionCode=|targetSdk=|flags=|installerPackageName=|firstInstallTime=|lastUpdateTime='
shared UID definitions with their own <sigs> and <perms>
<updated-package>
system app that has been updated by an APK in /data/app
# adb shell (root) — every shared-user group and its members
grep-o'sharedUserId="[0-9]*"'/data/system/packages.xml|sort|uniq-c|sort-rn
grep-E'<shared-user name='/data/system/packages.xml
5. Well-known AIDs (from system/core/libcutils/include/private/android_filesystem_config.h)¶
5.2 Networking / capability GIDs — the ones granted by permissions¶
GID
Value
Granted because the app holds
AID_NET_BT_ADMIN
3001
BLUETOOTH_ADMIN (legacy)
AID_NET_BT
3002
BLUETOOTH (legacy)
AID_INET
3003
android.permission.INTERNET
AID_NET_RAW
3004
raw sockets (system only)
AID_NET_ADMIN
3005
network admin (system only)
AID_NET_BW_STATS
3006
read bandwidth stats
AID_NET_BW_ACCT
3007
change bandwidth accounting
AID_READPROC
3009
read other processes' /proc entries
AID_WAKELOCK
3010
kernel wakelock control
AID_UHID
3011
create virtual HID devices
The permission → GID mapping itself lives in
frameworks/base/data/etc/platform.xml (<permission name=…><group gid=…/></permission>).
# adb shell — see the mapping the device actually uses
cat/system/etc/permissions/platform.xml|grep-B1-A3'permission name="android.permission.INTERNET"'
# host
adbinstallapp.apk
adbinstall-rapp.apk# reinstall, keep data
adbinstall-tapp.apk# allow test-only APK
adbinstall-dapp.apk# allow version downgrade
adbinstall-gapp.apk# grant all runtime permissions
adbinstall--user10app.apk# install into user 10
adbinstall--instantapp.apk# install as Instant App
adbinstall-icom.android.vendingapp.apk# fake the attributing installer
adbinstall--bypass-low-target-sdk-blockapp.apk# API 34+ blocks very old targetSdk
# adb shell — do it by handSZ=$(stat-c%s/data/local/tmp/app.apk)SID=$(pminstall-create-r-S$SZ|grep-o'[0-9]\+')
pminstall-write-S$SZ$SIDbase/data/local/tmp/app.apk
pminstall-commit$SID# or throw the session away:
pminstall-abandon$SID
# host — stream the APK over the session without staging it on the deviceSZ=$(stat-c%sapp.apk)SID=$(adbshellpminstall-create-r-S$SZ|tr-dc'0-9')
adbshellpminstall-write-S$SZ$SIDbase-<app.apk
adbshellpminstall-commit$SID
Command
Purpose
pm install-create [opts]
opens a session, prints Success: created install session [1234567]
pm install-write -S <size> <sid> <splitName> <path or ->
writes one APK into the session
pm install-commit <sid>
verify + commit atomically
pm install-abandon <sid>
destroy the session
pm install-existing --user N <pkg>
make an already-installed package visible to user N
# host — compute the expected categories for a UIDu=1010234;a=$((u%100000-10000));n=$((u/100000))echo"c$((a&255)),c$((256+(a>>8))),c$((512+(n&255))),c$((768+(n>>8)))"
# adb shell — who is closest to being killedforpin$(pidof-szygote64>/dev/null;ls/proc|grep-E'^[0-9]+$');don=$(tr-d'\0'</proc/$p/cmdline2>/dev/null);a=$(cat/proc/$p/oom_score_adj2>/dev/null)[-n"$n"]&&echo"$a$p$n"done|sort-rn|head-20
# adb shell — process importance from the framework's own view
dumpsysactivityprocesses|grep-E'Proc #|adj=|oom:'
dumpsysactivityoom
dumpsysmeminfocom.example.app
logcat-ball-slowmemorykillerlmkdActivityManager|grep-ikill
which task the Activity prefers; empty string isolates it
android:launchMode
standard, singleTop, singleTask, singleInstance
android:excludeFromRecents
hide task from Recents
android:allowTaskReparenting
Activity can move task — historic StrandHogg-class abuse
android:documentLaunchMode
multiple document tasks
11. android:debuggable — what it actually unlocks¶
Capability
Needs FLAG_DEBUGGABLE
Needs root
Notes
adb shell run-as <pkg>
yes
no
run-as reads field 3 of packages.list
JDWP debugger attach (adb jdwp, Android Studio)
yes
no
Zygote enables the JDWP thread
am set-debug-app -w <pkg>
yes
no
wait-for-debugger
setprop wrap.<pkg> … (LD_PRELOAD injection)
yes
no on user builds for debuggable apps
classic gadget-injection path
Frida via frida-server (root)
no
yes
root + ptrace, debuggable irrelevant
Frida Gadget embedded in APK
no
no
requires repackaging + re-signing
Frida via run-as + gadget (frida -U -f)
yes
no
non-root workflow
ptrace another process
n/a
yes (or same-uid + yama)
governed by SELinux + kernel.yama.ptrace_scope
Backup via adb backup
no
no
governed by android:allowBackup (deprecated API 31+)
# adb shell — is it debuggable?
dumpsyspackagecom.example.app|grep-o'DEBUGGABLE'
run-ascom.example.appid# succeeds only if debuggable# adb shell (root)
awk'$1=="com.example.app"{print "debugFlag="$3}'/data/system/packages.list
# host — from the APK, before installing
aapt2dumpxmltreeapp.apk--fileAndroidManifest.xml|grep-idebuggable
apkanalyzermanifestdebuggableapp.apk
# host — is the whole build debuggable?
adbshellgetpropro.debuggable
adbshellgetpropro.build.type# user / userdebug / eng
adbshellgetpropro.secure
# adb shell — Doze
dumpsysdeviceidle
dumpsysdeviceidleenable
dumpsysdeviceidleforce-idle# jump straight to deep idle
dumpsysdeviceidlestep# advance one state
dumpsysdeviceidleunforce
dumpsysdeviceidlewhitelist+com.example.app
dumpsysdeviceidlewhitelist-com.example.app
dumpsysbatteryunplug# required for Doze to engage
dumpsysbatteryreset
# adb shell — watch an install happen live
logcat-c
logcat-vtimePackageManager:VPackageInstaller:Vinstalld:Vdex2oat:VActivityManager:I'*:S'
Tag
Emitted by
What to look for
PackageInstaller
PackageInstallerSession
session create / write / commit
PackageManager
PMS
parse, verify, New package installed
installd
frameworks/native/cmds/installd
createAppData, restorecon, dexopt
dex2oat / dexopt
ART compiler
compiler filter, time taken
ActivityManager
AMS
Start proc, broadcast delivery
PackageParser / ParsingPackageUtils
manifest parsing
malformed-manifest errors
ApkSignatureVerifier
signature check
v2/v3 verification failures
# adb shell — see PACKAGE_ADDED land
logcat-vtime|grep-E'ACTION_PACKAGE_ADDED|android.intent.action.PACKAGE_'
dumpsyspackager|head-40# resolvers
cmdpackagecompile-mspeed-fcom.example.app# force AOT recompile
# host — pull every APK of a package (base + splits)forpin$(adbshellpmpathcom.example.app|tr-d'\r'|sed's/package://');doadbpull"$p";done# host — package name of the app currently on screen
adbshelldumpsyswindow|grep-E'mCurrentFocus|mFocusedApp'
adbshelldumpsysactivityactivities|grepmResumedActivity
# host — launcher activity of a package
adbshellcmdpackageresolve-activity--briefcom.example.app|tail-1
# host — start / stop / clear
adbshellamstart-ncom.example.app/.MainActivity
adbshellamforce-stopcom.example.app
adbshellpmclearcom.example.app
# host — every UID that shares an appId with another package
adbshellpmlistpackages-U|tr-d'\r'|sed's/package://;s/uid://'\|awk'{print $2, $1}'|sort-n|awk'{c[$1]=c[$1]" "$2} END{for(u in c){n=split(c[u],a," "); if(n>1) print u, c[u]}}'# host — size of a package's data (root)
adbshell"su -c 'du -sh /data/data/com.example.app /data/user_de/0/com.example.app'"# host — file contexts of app data
adbshell"su -c 'ls -laZ /data/data/com.example.app'"# host — which processes belong to one app
adbshellps-A-oUSER,PID,PPID,NAME|grepcom.example.app
# host — kill just one of a multi-process app's processesPID=$(adbshellpidofcom.example.app:worker|tr-d'\r')
adbshell"su -c 'kill $PID'"# host — dump the merged manifest of an installed app
adbshellpmpathcom.example.app|sed's/package://'|head-1|xargs-I{}adbpull{}base.apk
aapt2dumpxmltreebase.apk--fileAndroidManifest.xml|less
# host — list every provider a package declares (persistence hunting)
adbshelldumpsyspackagecom.example.app|sed-n'/Provider Resolver Table/,/Service Resolver Table/p'
adbshelldumpsyspackageproviders|grep-A5com.example.app