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
- ▸Native Libraries - C/C++ libs used by the framework: OpenGL ES (graphics), SQLite (database), WebKit (browser engine), libc (C standard library), libssl (TLS)
- ▸Android Runtime (ART) - replaces the old Dalvik VM. ART uses AOT (Ahead-of-Time) compilation to convert DEX bytecode to native machine code at install time, making apps run faster
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.
- ▸ActivityManager - app lifecycle, back stack, multitasking
- ▸ContentProvider - structured data sharing between apps
- ▸NotificationManager - system notification display
- ▸LocationManager - GPS and network location
- ▸TelephonyManager - calls and SIM information
- ▸PackageManager - installed apps and permissions
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.