Android OS architecture (1)
Android OS architecture (1)
Android Framework
Architectural
Native Libraries & ART
layers
Hardware Abstraction Layer
Linux Kernel
The Linux Kernel layer
Function:
This layer provides a foundation for the Android Operating
System.
It manages device drivers, all hardware resources and offers
basic services such as networking.
Key Components:
1.Process Management
This layer is in charge of process creation, process scheduling and process
termination to release allocated resources.
2.Memory Management
The kernel layer is also in charge of memory allocation and deallocation for
efficient use of the RAM.
3.Device Drivers
Device Drivers are software components that enable communication between
the operating system and hardware devices.
The Linux Kernel layer manages device drivers that interact with hardware
devices for example the camera, keyboard.
4.Networking
It also manages network interfaces for example wi-fi and does packet scheduling.
Hardware Abstraction Layer (HAL)
Definition
· The Hardware Abstraction Layer (HAL) is a critical component in Android’s
architecture that acts as a bridge between the operating system and device hardware.
Purpose
· Provides a standardized interface for the Android framework to communicate with
hardware components.
· Abstracts hardware details to simplify development and ensure compatibility.
Role
· Enables apps and the Android system to function on diverse devices without
requiring hardware-specific changes.
· Supports modular design for easier OS updates without altering hardware drivers.
How HAL Works and Its Benefits
Interaction Path
· Apps → Framework → HAL → Drivers → Hardware
· HAL bridges the gap between Android APIs and hardware-specific drivers, allowing
seamless communication.
Benefits
· Compatibility: Ensures apps and the OS can run across various devices.
· Modularity: Decouples hardware-specific code from the operating system, simplifying
updates.
· Custom Features: Allows hardware vendors to implement unique capabilities.
Standardization
· HIDL (HAL Interface Definition Language): Introduced in Android 8 (Oreo) to define
consistent interactions between the OS and hardware.
· Ensures reliability, compatibility, and easier testing of hardware components.
Android Runtime (ART )
What is ART?
The third layer of Android OS architecture, responsible for executing and
managing applications.
Replaced the Dalvik Virtual Machine (VM) starting from Android 5.0
(Lollipop). Converts app bytecode to native machine code during
installation for better performance and memory optimization.
Key Features
1. Ahead-of-Time (AOT) Compilation
a. Converts bytecode to native code at installation (unlike Dalvik's JIT model).
b. Improves startup speed, execution efficiency, and battery life.
2. Garbage Collection (GC) Optimization
a. Efficient GC reduces pauses and improves performance.
b. Uses concurrent GC to minimize stuttering and lag.
3. Improved Memory Management
a. Optimizes RAM usage via memory mapping (mmap).
b. Reduces memory overhead by sharing code across apps.
4. Support for Multiple Architectures
a. Works with ARM, x86, and MIPS (32-bit & 64-bit). b. 64-bit support improves memory access
and performance.
5. Enhanced Debugging & Profiling
a. Advanced tools for performance tracing and error detection.
b. Detailed crash reports with precise error locations
How ART Works in the Android App Lifecycle
1. App Installation: APK compiled to native machine code using AOT.
2. App Launch: Precompiled code loads, enabling faster startup.
3. App Execution: Optimized memory management & garbage collection for
smooth performance.
Performance optimizations
libprofile.so improves execution based on real usage patterns.
libicui18n.so ensures proper text rendering across languages.
2. Third-party apps:
These are apps that users can install from Google
Playstore or other sources.
Examples include:
Social media apps
Games.
ANDROID PROGRAMMING
ENVIRONMENT
This is made up of tools, languages, and concepts
for Android app development.
These include...
Languages for
Android Development
· Primary Language: Kotlin
· Modern features, null safety, and Java
interoperability.
· Preferred for Android apps.
2. Android Emulator:
· Simulates various devices for testing
apps without physical hardware.
1. Manifest File (AndroidManifest.xml):
Android · Defines app components, permissions, and
Project metadata.
Structure 2. Code:
· Java/Kotlin files for app logic (e.g., Activities,
Fragments).
3. XML Layouts:
· UI design files.
1. Activity Lifecycle:
· States like onCreate, onStart, onResume, etc.
2. Fragment Lifecycle:
· Similar to activities but more modular.
1. What is it?
· A suite of libraries and tools to build
robust apps.
2. Key Features:
· Compose: Modern UI toolkit. Android
· ViewModel: Manages UI-related
data in a lifecycle-conscious way. Jetpack
· Navigation: Simplifies app
navigation.
· Room: SQLite abstraction for local
databases.
Thank you