← Back to Blogs

Android Architecture

The five layers that make Android work

1 min read

Android's architecture is divided into five distinct layers. Each layer only interacts with the one directly below or above it, creating clean separation of concerns and making the system modular and maintainable.

Android Architecture Layers

  ┌──────────────────────────────────────────┐
  │            Applications                  │
  │   Phone  Browser  Camera  Maps  Gmail    │
  └──────────────────────────────────────────┘
  ┌──────────────────────────────────────────┐
  │         Application Framework            │
  │  Activity  Content  Notification  View   │
  │  Manager   Provider  Manager      System │
  └──────────────────────────────────────────┘
  ┌───────────────────┐  ┌───────────────────┐
  │  Native Libraries │  │  Android Runtime  │
  │  OpenGL  SQLite   │  │  ART  Core Libs   │
  │  WebKit  libc     │  │  (DEX/AOT)        │
  └───────────────────┘  └───────────────────┘
  ┌──────────────────────────────────────────┐
  │   Hardware Abstraction Layer (HAL)       │
  │   camera.hal  audio.hal  sensors.hal     │
  └──────────────────────────────────────────┘
  ┌──────────────────────────────────────────┐
  │              Linux Kernel                │
  │   Drivers  Memory  Power  Binder IPC     │
  └──────────────────────────────────────────┘

Layer 1: Linux Kernel

The foundation of Android. The Linux kernel handles memory management, process scheduling, hardware drivers, networking, and security. Android adds its own kernel features on top - Binder IPC, wake locks, ashmem (anonymous shared memory), and ION memory allocator.

Layer 2: HAL (Hardware Abstraction Layer)

HAL sits between the kernel drivers and the Android framework. Each piece of hardware (camera, audio, sensors, GPS) has its own HAL module (.so file) that implements a standard interface. This keeps vendor-specific code isolated from the framework.

Layer 3: Native Libraries + Android Runtime

Layer 4: Application Framework

The Java/Kotlin APIs that app developers use day-to-day. These framework services run inside System Server and are accessed via Binder IPC.

Layer 5: Applications

The topmost layer - standard apps like Phone, Settings, Camera, and third-party apps from the Play Store. They all share the same framework APIs regardless of the hardware underneath, which is exactly what the lower layers are designed to enable.

Key insight: Project Treble (Android 8+) added a hard boundary between the HAL layer and the framework. Vendor code (HAL + kernel) lives in the /vendor partition, framework code in /system. This makes it possible to update Android without each manufacturer rebuilding their drivers.