PPrepLearn
Progress Β· 0/7 phases

πŸš€ πŸš€ Phase 6 β€” Customization, OTA & Contributing

5 min read Β· Notion

Phase 6 β€” Customization, OTA & Contributing

Duration: 3–4 weeks | Level: Expert

Build a custom ROM. Understand OTA updates. Contribute back to AOSP.


πŸ“± Building a Custom ROM

What is a custom ROM?

A custom ROM = a full Android OS build (system.img, vendor.img, boot.img) customized beyond stock AOSP.

Popular custom ROMs: LineageOS, GrapheneOS, CalyxOS β€” all based on AOSP.

ROM customization areas

AreaWhat you can change
SystemUIStatus bar, notification shade, quick settings
SettingsAdd custom settings panels
LauncherReplace the home screen
Build flagsFeature flags, debug options
Init.rcService startup behavior
KernelCPU governor, I/O scheduler
HALCustom camera/audio processing

🎚️ SystemUI Customization

SystemUI is the process that renders the status bar, notification shade, lock screen, and navigation bar.

Source: frameworks/base/packages/SystemUI/

packages/SystemUI/src/com/android/systemui/
β”œβ”€β”€ statusbar/           # Status bar + notification shade
β”œβ”€β”€ qs/                  # Quick Settings tiles
β”œβ”€β”€ navigationbar/       # Navigation bar
β”œβ”€β”€ lockscreen/          # Lock screen
└── keyguard/            # Keyguard (PIN/pattern/biometric)

Add a custom Quick Settings tile

// 1. Create class extending TileService
public class MyCustomTile extends TileService {
    @Override
    public void onTileAdded() { }
 
    @Override
    public void onClick() {
        // toggle something
        getQsTile().setState(Tile.STATE_ACTIVE);
        getQsTile().updateTile();
    }
}
 
// 2. Register in SystemUI manifest
// 3. Add to default tile list in config

πŸ“¦ OTA (Over-The-Air) Updates

Android OTA architecture

Server generates OTA package (.zip)
  ↓
Device downloads to /data/ota_package/
  ↓
Update Engine (update_engine daemon)
  ↓
A/B partition switch OR Recovery mode flash
  ↓
Device reboots into new system

A/B (Seamless) Updates (Android 7.0+)

  • Device has two sets of system partitions (slot A and slot B)
  • New system written to inactive slot while device is running
  • On next boot, device switches to updated slot
  • If boot fails, rolls back to previous slot automatically
  • No downtime for user during update

Generating an OTA package

# Full OTA
m otapackage
 
# Output: out/target/product/<device>/β€˜device’-ota-*.zip
 
# Incremental OTA (delta between two builds)
android/tools/releasetools/ota_from_target_files.py \
  -i old_build.zip new_build.zip incremental_ota.zip

Recovery mode

  • Minimal Linux environment separate from main Android
  • Can flash system partition from OTA zip
  • Source: bootable/recovery/

πŸ” Android Verified Boot (AVB)

AVB ensures the device only boots signed, unmodified system images:

Bootloader verifies kernel signature
  ↓
Kernel verifies dm-verity hash tree of /system partition
  ↓
Any modification to /system β†’ boot fails
  • Prevents persistent rootkits
  • OEM key stored in bootloader (efuse)
  • Unlocking bootloader disables AVB and wipes device

🀝 Contributing to AOSP

Gerrit β€” Android's code review system

AOSP uses Gerrit (at android-review.googlesource.com) for all code reviews.

Submit a patch step-by-step

# Step 1: Create a branch
cd frameworks/base
git checkout -b my-fix
 
# Step 2: Make your change
# edit files...
 
# Step 3: Commit with proper message
git add -A
git commit -m "Fix: correct NPE in ActivityManagerService
 
This commit fixes a NullPointerException that occurs when...
 
Bug: 12345678
Test: atest ActivityManagerServiceTest"
 
# Step 4: Upload to Gerrit
git push origin HEAD:refs/for/main

AOSP commit message format

<component>: <short description>
 
<detailed explanation of why the change is needed>
 
Bug: <bug number or 'None'>
Test: <how to verify the fix>

Good first contributions

  • Fix typos in comments/documentation
  • Fix lint warnings
  • Improve error messages
  • Fix small bugs in non-critical paths
  • Add test coverage
  • Browse: https://issuetracker.google.com/issues?q=status:open%20component:192705

πŸ“š Key AOSP Resources

ResourceURL
AOSP Source Browserhttps://cs.android.com
AOSP Documentationhttps://source.android.com
Gerrit Code Reviewhttps://android-review.googlesource.com
Issue Trackerhttps://issuetracker.google.com
Android Developers Bloghttps://android-developers.googleblog.com
AOSP on GitHub (mirror)https://github.com/aosp-mirror

πŸ› οΈ Hands-On Tasks

  1. Modify SystemUI status bar to show a custom icon permanently.
  2. Customize the Settings app β€” add a new preference screen.
  3. Build an OTA package with m otapackage and flash it on the emulator.
  4. Study LineageOS source β€” pick one of their custom features and understand how it works.
  5. Find a real AOSP bug on the issue tracker and study the patch that fixed it on Gerrit.
  6. Submit your first AOSP change (even a docs typo fix counts!).

βœ… Phase 6 Checklist

  • Understand SystemUI process structure
  • Modified status bar or added a QS tile
  • Understand A/B partition update model
  • Know how OTA packages are generated
  • Understand Android Verified Boot (AVB)
  • Can generate an OTA package with m otapackage
  • Set up Gerrit account (android-review.googlesource.com)
  • Know AOSP commit message format
  • Studied at least one LineageOS custom feature patch
  • Submitted or reviewed a change on Gerrit

Related