Files
aosp_guide/introduction.md
2025-06-23 21:15:34 +05:30

5.3 KiB
Raw Permalink Blame History

WELCOME

If you came to learn about AOSP then youre in exactly the right place to start from scratch. The Android source code might look intimidating at first, but once we peel back the layers bit by bit, it starts to make a lot more sense. Since you're exploring AOSP from the ground up, In this you can learn about it and how to customize it and build it and use it in your phone in a structured way.

Also kepp in mind that Im doing this as an side hobby to my main hobby so i will try to finish this when ever i have time.

Lets start by building a foundational Knowledge about AOSP

BEFORE YOU CONTINUE REMEMBER THIS CONDITION: YOU ARE NOT ALLOWED TO REPRODUCE THIS GUIDE BY FORM TO BUSSINESS. THIS IS FULLY FREE OPENSOURCE. IF YOU WANT TO MAKE AN MORE APPEALING RELIABLE WAY TO TEACH THEN GO AHEAD AND COPY, FORK , DO WHATEVER YOU WANT BUT MAKE IT FREE, OPENSOURCE, EASY TO ACCESS. DONT ACT CLEVER.

What is Android?

Android is not just an operating system — its a software stack built to run on hardware that might have no keyboard, no mouse, no user with root. It blends:

  • A Linux kernel to manage memory, devices, and processes.
  • A set of native libraries to talk to hardware and do heavy lifting (SQLite, OpenGL, libmedia).
  • A custom C library (bionic) built for speed and small footprint.
  • A Java-based application runtime that executes apps via the Android Runtime (ART).
  • A framework of system services that expose hardware and OS features to apps.
  • A security sandbox using permissions, UIDs, SELinux, and more.

Android is simultaneously:

  • A Linux-based OS,
  • A runtime virtual machine system,
  • A real-time device controller,
  • And a platform for user-facing apps.

How Is It Layered? (The Real Stack)

Lets build it from the bottom up:

🔌 Hardware (CPU, GPU, WiFi, Audio)
  └─ Kernel (Linux + Android patches)
      └─ HAL (Hardware Abstraction Layer)
          └─ Native Libraries (C/C++ - libcamera, libaudio, etc.)
              └─ Android Runtime (ART)
                  └─ Framework (Java APIs + System Services)
                      └─ Apps (SystemUI, Settings, 3rd-party apps)

Each layer talks only to the one below or above it. This is key to Androids modularity — especially post-Project Treble.

Who Runs the Show?

Android runs multiple “worlds” at once:

Actor Role
init First userspace program — spawns everything.
root user Owns early daemons and critical services.
system user Runs many Android services (like Zygote).
app_* UIDs Every app has its own UID, sandbox, and SE domain.
SELinux Enforces Mandatory Access Control at runtime.

This isnt a simple “everything is root” Linux OS — Android is deeply compartmentalized, by design.


Core Pillars That Power Android

These are internal subsystems youll soon master:

  • Binder IPC: A high-speed communication bus for everything (init → Zygote, App → Service, etc.)
  • Zygote: A pre-loaded Java runtime that forks apps to save time/memory.
  • System Server: Core Java service manager (ActivityManager, WindowManager, etc.)
  • HALs: Hardware interfaces, now split into modules (android.hardware.*) and often vendor-owned.
  • Properties: System-wide variables like ro.build.type or persist.sys.theme.
  • Overlay System: Used to change system UI behavior without modifying APKs (RRO/OMS).
  • Partitions: /system, /vendor, /product, /boot, /data — each plays a defined role.

This is the framework that everything else will plug into. Youve now met the major players, understood the control model, and seen how Android is not just Linux with extras — its a carefully layered OS built for scalability, modularity, and un-rooted users.

What is AOSP?

The Android Open Source Project (AOSP) is the official open-source codebase of Android maintained by Google. It includes all the components that power Android devices — from the low-level kernel, up to the system apps and libraries.

It's split into layers, kind of like a cake:

  1. Linux Kernel The core that manages hardware.
  2. HAL (Hardware Abstraction Layer) A bridge between hardware and Android services.
  3. Native Libraries Written in C/C++ and power media, graphics, etc.
  4. Android Runtime (ART) Runs your apps written in Java or Kotlin.
  5. Framework Layer High-level APIs that app developers use.
  6. System Apps Phone, Contacts, Settings, etc. . . .

Note : This whole guide is made with reference to the latest stable Android 15 release. Not Android 16. Once Android 16 gets stable release , then i will update it quickly.

Tools You'll Eventually Use

  • repo For syncing and managing Android source.
  • lunch, make To configure and build the OS.
  • adb To talk to Android devices.
  • fastboot For flashing firmware.
  • Theres is much more, you will get to know about it later in this guide.

I will explain each part step-by-step as i learned. Sit back tight. Lets Jump into AOSP Source Tree Structure.