Android System Architecture (Layered View)

Explain Android System architecture with all the software stack?

Understanding Android System Architecture is crucial — especially for developers, architects, and system engineers like you. Let me break it down layer-wise from bottom to top — this is typically referred to as the Android Software Stack or Android Architecture.

Android System Architecture (Layered View)

--------------------------------------
| Applications Layer                |
--------------------------------------
| Application Framework Layer       |
--------------------------------------
| Android Runtime (ART) + Libraries |
--------------------------------------
| HAL (Hardware Abstraction Layer) |
--------------------------------------
| Linux Kernel Layer                |
--------------------------------------

1. Linux Kernel Layer (Bottom-most Layer)

  • The base of Android OS is a modified Linux Kernel (usually LTS versions).

Key responsibilities:

  • Hardware Drivers (Display, Camera, Wi-Fi, Audio, Bluetooth)
  • Power Management
  • Memory Management
  • Security (SELinux, User permissions)
  • Process Management (Multitasking)
  • Networking (TCP/IP Stack)

2. HAL (Hardware Abstraction Layer)

  • A layer of C/C++ modules that expose standard APIs to higher layers for hardware interaction.

HAL Modules examples:

HAL ModulePurpose
audio.hAudio Driver Access
camera.hCamera Driver Access
sensors.hSensor Data Handling
wifi.hWi-Fi Module Access

It abstracts hardware-specific implementations from Android OS.

3. Android Runtime (ART) + Native Libraries

a) Android Runtime (ART)

  • Replaced Dalvik (from Android 5.x)
  • Executes apps written in Java/Kotlin
  • Performs AOT (Ahead-Of-Time) & JIT (Just-In-Time) compilation.
  • Handles Garbage Collection, Multithreading, and Core Java APIs.

b) Native Libraries (C/C++ Libraries)

  • SQLite (Relational DB Engine)
  • OpenGL ES (Graphics)
  • Webkit (Browser Engine)
  • SSL (Security)
  • libc (Standard C Library)
  • Media Framework (Audio, Video Codecs)

Native Libraries provide system-level functionalities optimized in C/C++.

4. Application Framework Layer

This is the SDK API Layer provided to developers.

Core Managers & Services:

ComponentRole
Activity ManagerControls app lifecycle
Package ManagerHandles app install/uninstall
Window ManagerManages views, windows
Notification ManagerSystem notifications handling
Location ManagerAccess GPS, network location
Content ProvidersApp data sharing mechanism
Telephony ManagerAccess cellular data, network info

Developers build apps using this layer via Android SDK.

5. Applications Layer (Top-most Layer)

  • User-installed Apps (via Google Play)
  • Pre-installed System Apps (Phone, SMS, Camera, Settings)
  • OEM/Custom Apps (added by device manufacturers)

These apps use the Application Framework APIs to access device functionalities.

Diagram View (High Level)

|------------------- Applications ---------------------|
|          System Apps         |     User Apps         |
|------------------------------------------------------|
|------------- Application Framework APIs ------------|
| Services | Managers | Providers | Views etc.        |
|------------------------------------------------------|
| Android Runtime (ART) + Native C/C++ Libraries      |
|------------------------------------------------------|
| Hardware Abstraction Layer (HAL)                    |
|------------------------------------------------------|
| Linux Kernel (Device Drivers, Power, Security etc.) |

Summary

LayerPurpose
Linux KernelHardware interaction & Security Layer
HALHardware Abstraction for Android APIs
Android Runtime & LibsApp execution & System Libraries
Application FrameworkSDK APIs for developers
Applications LayerEnd-user visible Apps

This architecture provides modularity, security, and scalability.
OEM vendors like Samsung, Xiaomi customize lower layers (Kernel, HAL), while app developers mostly interact with the Application Framework.

Would you like me to create a diagram or architecture flow chart for this?

I can generate that for you!

Does entire Device software stack get installed on ROM? or its installed as different components or layers on different storage devices with in the device?

This goes deeper into how Android OS is actually stored and laid out on the device hardware. Let’s clarify this with real-world Android architecture.

Short Answer:

No — The entire Android OS is not stored in a single ROM (Read-Only Memory) chip like old feature phones. Modern Android Devices use internal flash storage (eMMC / UFS) which is partitioned logically into multiple sections (partitions) — each dedicated to specific components of the Android software stack.

Where is Android OS Stored?

Android OS components are stored on internal storage (usually NAND Flash memory) but divided logically into partitions.

Typical Android Partition Layout

Partition NameContainsPurposeWritable?
boot / boot_aKernel + RAMDiskBoot the deviceNo (Read-only)
recoveryRecovery OSFor system repair/resetNo
system / system_aAndroid Framework & System AppsCore OS filesNo
vendorVendor-specific HAL & driversHardware abstractionNo
userdataUser-installed Apps, DataApps, SettingsYes
cacheTemporary dataOptimizing systemYes
miscConfig DataBoot config etc.Yes
modem / radioCellular firmwareModem firmwareNo

Storage Media Used

ComponentStorage TypeCharacteristics
BootloaderStored in ROM (or Secure Flash)Verified by SoC
Kernel & RamdiskBoot Partition (Flash)Read-only during normal boot
System & VendorFlash storage partitionsAndroid framework & drivers
User DataFlash storage partitionsWritable – apps, files
Firmware (Modem, DSP)Dedicated partitionsRadio, Bluetooth, WiFi drivers

Visualization — Storage Layout in Android Device:

|-------------- eMMC / UFS Storage ---------------|
| Bootloader | Boot | Recovery | System | Vendor |
| Cache | Userdata | Modem | Misc | Others |
---------------------------------------------------

Boot Sequence (How Android Loads)

  1. Power On
  2. SoC executes Bootloader (from ROM / Secure Flash)
  3. Bootloader loads Linux Kernel from boot partition
  4. Kernel mounts system and vendor partitions
  5. Init process starts (from Android Runtime)
  6. Framework layer & Services start
  7. User Apps loaded from userdata

Key Takeaways:

1. Storage is Partitioned

  • Android OS is modularized across multiple partitions.
  • Each partition has a dedicated purpose.

2. Not Entirely in ROM

  • Only Bootloader code resides in secure or ROM storage.
  • OS Kernel, Framework, System apps — stored in Flash storage (read-only partitions).

3. User Data is Writable

  • userdata partition is writable — this is where user apps, media, settings, and cache exist.

Final View of Android System Deployment:

| Bootloader (ROM / Secure Flash) |
| Boot Partition (Kernel + Initramfs) |
| System Partition (Framework + System Apps) |
| Vendor Partition (Device-specific HAL, drivers) |
| Userdata Partition (Apps, Data, Cache) |

Bonus Tip for Developers:

  • When you build a Custom ROM or AOSP build — you create system.img, boot.img, vendor.img, userdata.img — which get flashed into respective partitions.

Would you like me to explain:

  • Android File System Hierarchy ( /system, /vendor, /data )?
  • Android Boot Process in detail?
  • Android Recovery vs Bootloader modes?

Let me know — happy to go deeper!

Android File System Hierarchy

This is the next logical step — Let me break down Android File System Hierarchy in a way that maps with both developer view and internal device storage.

What is Android File System Hierarchy?

It is the directory structure/layout inside Android OS after boot — similar to Linux directory structure but customized for mobile devices. After Android boots — the Kernel mounts several partitions into specific mount points (directories).

Core Android File System Layout — (Simplified View)

/
├── boot        → Kernel & Ramdisk (not visible after boot)
├── system/     → Android OS Framework & System Apps
├── vendor/     → Hardware specific drivers, HAL
├── product/    → Google-specific / OEM features
├── odm/        → Device-specific customization
├── data/       → User-installed Apps, App Data
├── cache/      → Temporary Cache files
├── sdcard/     → User-accessible storage
└── proc/, sys/ → Kernel virtual filesystems

Directory Purpose & Details

DirectoryPurposeWritable?Mounted from
/systemAndroid Framework, System AppsNosystem partition
/vendorHAL, Device drivers, LibrariesNovendor partition
/odmDevice-specific configNoodm partition
/dataApps, User Data, DBs, SettingsYesuserdata partition
/cacheDalvik Cache, OTA updatesYescache partition
/bootKernel, RamdiskNoboot partition
/sdcardUser Files, Downloads, PhotosYesuserdata partition (virtualized)
/proc, /sysKernel Info (virtual fs)Yes (Runtime info)RAM

Important Android Specific Directories Inside /system

/system
├── app/          → Pre-installed System Apps (.apk)
/system
├── priv-app/     → Privileged Apps (core apps with special permissions)
/system
├── bin/          → System Binaries
/system
├── lib/ or lib64/→ Shared Libraries (.so)
/system
├── etc/          → Config Files (init configs, permissions)
/system
├── fonts/        → Fonts used by System
/system
├── build.prop    → System-wide properties file

User Data Directory Structure

/data
├── app/          → Installed App Packages
├── data/         → App-specific Data (sandboxed)
/data
├── user/         → Multi-user Data Storage
├── misc/         → Miscellaneous System Data
├── dalvik-cache/ → Optimized App Bytecode Cache
├── media/        → User Photos, Videos

Diagram — Android Storage vs File System Hierarchy

Physical Storage (Partitions)
-------------------------------
| boot   | system | vendor | data | cache |

Mounted File System (Linux FS View)
-----------------------------------
/ → Root Directory
|
|-- /system  → Mounted from system.img
|-- /vendor  → Mounted from vendor.img
|-- /data    → Mounted from userdata.img
|-- /cache   → Mounted from cache.img
|-- /sdcard  → Virtual storage (internal/external)

Important Characteristics:

AreaRead/WriteNotes
/systemRead-Only (unless rooted)Contains core OS files
/vendorRead-OnlyDevice drivers
/dataRead/WriteApp installed, user settings
/cacheRead/WriteOTA, temporary files
/sdcardRead/WriteUser-accessible storage

Final Summary of Android File System:

  • /system → Android OS Framework
  • /vendor → Hardware Abstraction Layer
  • /data → Apps & User Data
  • /cache → Temporary files & OTA updates
  • /sdcard → User storage (Pictures, Downloads)
  • /proc & /sys → Kernel interfaces (virtual)

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top