06 — Android Architecture · References
Annotated. Each entry says why you would open it, so you can pick the right one under time pressure.
AOSP source
Read on cs.android.com . See 07-AOSP for the
navigation technique. File paths are stable across releases; line numbers are not.
Boot and init
Path
Open it when
system/core/init/init.cpp
Tracing what PID 1 actually does
system/core/init/service.cpp
Understanding Service::Start() — fork, setexeccon, capabilities, setuid, exec
system/core/init/service_parser.cpp
Working out what an .rc option means
system/core/init/property_service.cpp
The write path and CheckPermissions() — the SELinux asymmetry
system/core/init/action_manager.cpp
How triggers fire
system/core/rootdir/init.rc
The default init script; what starts in what order
system/core/init/ueventd.cpp
Device node creation
Zygote — the most important reading in this chapter
Path
Open it when
frameworks/base/cmds/app_process/app_main.cpp
The binary init execs to create Zygote
frameworks/base/core/jni/AndroidRuntime.cpp
startVm() — every ART option, many from dalvik.vm.*
frameworks/base/core/java/com/android/internal/os/ZygoteInit.java
Preload and the select loop
frameworks/base/core/java/com/android/internal/os/ZygoteConnection.java
Argument parsing
frameworks/base/core/jni/com_android_internal_os_Zygote.cpp
SpecializeCommon() — where the app sandbox is actually built. If you read one function, read this
frameworks/base/core/java/com/android/internal/os/RuntimeInit.java
How the child becomes an app
Framework
Path
Covers
frameworks/base/services/java/com/android/server/SystemServer.java
Service startup order — a map of the framework
frameworks/base/services/core/java/com/android/server/
am/, pm/, wm/, power/ — the services themselves
frameworks/base/core/java/android/app/ActivityThread.java
The app process entry point
frameworks/native/cmds/servicemanager/
Service registration and Access.cpp's SELinux check
frameworks/native/libs/binder/
IPCThreadState.cpp, Parcel.cpp — see 25
Path
Covers
bionic/libc/system_properties/
The property implementation: prop_area.cpp, the trie
bionic/libc/seccomp/
The syscall allow-lists Zygote installs
system/sepolicy/
The MAC policy; property_contexts, seapp_contexts, file_contexts
system/apex/
apexd and the APEX container format
external/avb/
avbtool and the vbmeta format
system/core/fs_mgr/
liblp (dynamic partitions) and verity setup
system/vold/
Volume management and FBE key handling
system/memory/lmkd/
The userspace low-memory killer
hardware/interfaces/
Every HAL interface, HIDL .hal and AIDL
Official documentation
Architecture
Boot, integrity and partitions
Mainline
Properties and services
Security
Tool
Use
adb / fastboot
See 60 and 61
getprop / setprop / getprop -Z
The property service
dumpsys / service list
Binder services
ps -A -Z
Processes with SELinux domains
lpdump
Dynamic partition layout
avbtool (external/avb/)
Read and verify vbmeta descriptors
magiskboot
Unpack and repack boot.img
Android_boot_image_editor
Alternative boot image tooling
lpunpack / lpmake
Unpack and build super.img
payload-dumper-go
Extract partitions from an OTA payload.bin
Perfetto / atrace
Boot-time and system tracing
Chapter scripts
Work
Why
Android Internals: A Confectioner's Cookbook — Jonathan Levin
The deepest published treatment of init, Zygote, the property service and the boot chain
Android Security Internals — Nikolay Elenkov
The best structural account of the security architecture; dated in specifics, excellent in framing
The Android Hacker's Handbook — Drake et al.
Older, but the platform-exploitation chapters explain why the architecture looks like this
Embedded Android — Karim Yaghmour
Written from the device-builder's perspective, which is exactly the view you need for OEM assessment
Research worth following
Google Project Zero — https://googleprojectzero.blogspot.com/ — the highest-quality public
Android platform research, and a good model for how to write up architectural findings
Android Security Bulletins — read monthly for the pattern : which layers and which vendor
components keep appearing
Hardwear.io, OffensiveCon, Recon — the conferences where bootloader, TEE and firmware research
is presented
Note on CVE citation. This chapter describes vulnerability classes per layer rather than naming
identifiers, because platform bugs are numerous, version-specific and vendor-specific. A
misattributed CVE in a client report is worse than no citation. Pull specifics from the bulletin for
the affected release.
Chapter
Relationship
07-AOSP
Navigating and building the source tree this chapter cites
08-Build-System
How the images described here are produced
09-Android-App-Internals
App identity, UID allocation, the install flow
11-Android-Runtime
The runtime layer in depth
13-ART
The ART implementation and its Mainline module
19-Memory
The Zygote ASLR consequence, in exploitation terms
20-Security-Architecture
Verified Boot, FBE and Play Integrity in depth
21-App-Sandbox
What SpecializeCommon() actually builds
22-SELinux
Domains, seapp_contexts, property contexts
24-IPC
Sockets, including the world-accessible ones this chapter's audit finds
25-Binder
The transport underneath the framework
60-ADB
The protocol behind every command here
61-Fastboot
Bootloader, partitions, and flashing without destroying a device