0% found this document useful (0 votes)
70 views27 pages

Android OS architecture (1)

The document provides an overview of the Android operating system architecture, detailing its five main layers: Application layer, Android Framework, Native Libraries & ART, Hardware Abstraction Layer, and Linux Kernel. It explains the functions and key components of each layer, emphasizing the roles of the Linux Kernel in managing hardware resources and the Hardware Abstraction Layer in ensuring compatibility across devices. Additionally, it discusses the Android Runtime (ART) and core libraries that enhance app performance and memory management.

Uploaded by

ann karagwa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
70 views27 pages

Android OS architecture (1)

The document provides an overview of the Android operating system architecture, detailing its five main layers: Application layer, Android Framework, Native Libraries & ART, Hardware Abstraction Layer, and Linux Kernel. It explains the functions and key components of each layer, emphasizing the roles of the Linux Kernel in managing hardware resources and the Hardware Abstraction Layer in ensuring compatibility across devices. Additionally, it discusses the Android Runtime (ART) and core libraries that enhance app performance and memory management.

Uploaded by

ann karagwa
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 27

Introduction

Android is a popular mobile operating system by Google.


It is Open Source therefore a first choice for developers and
consumers.
Android OS runs on top of Linux.
Android OS architecture is structured into five main layers.
Each layer plays a vital role in the functionality and usability
of Android devices. These include...
Application layer

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.

Why ART Matters


Speeds up Android apps while consuming less power and memory.
Reduces app lag, making Android devices feel smoother.
Better debugging tools for developers to optimize their apps.
Core libraries (ART)

Provide essential java APIs for app development and


responsible for executing and managing Android
applications. These libraries provide fundamental support
for Java/Kotlin apps and interact with both native system
libraries and the Android Framework.
Core Libraries Examples
App execution
libart.so runs compiled code efficiently.
libdexfile.so handles DEX parsing if needed.
libnativehelper.so bridges Java and native C/C++ code.

Performance optimizations
libprofile.so improves execution based on real usage patterns.
libicui18n.so ensures proper text rendering across languages.

Why These Core Libraries Matter


Faster execution
Efficient memory use
Better debugging
Native libraries
In the android 0S architecture, the native libraries are located
between the Android Runtime (ART) and Application
Framework.
These native libraries are precompiled code written in
languages like Cor C++ offering efficient performance for
resource-intensive tasks.
Purpose: These libraries provide the tools and services needed
for core functionalities like graphics rendering, data storage,
multimedia processing and more.
They bridge the gap between hardware and higher-level APIs.
Key native libraries used in Android include:
1. Bionic Libic: Provides the core system-level functions such as memory
management, process creation and thread management.
2. SurfaceFlinger: Composes the display output for the screen.
3. OpenGL ES: Used by applications like games and other graphics-intensive
apps
4. SQLite: Provides local data storage for apps.
5. Media Framework: This handles audio and video codecs like MP4
6. Webkit: A browser engine used for rendering web pages.
7. SSL/TLS libraries: Used for secure communication (e.g., OpenSSL)
8. Freetype: Used for rendering font and texts.
9. Libcutils: It’s a utility library for common system operations.
10. Libc++ and Libart: Libraries for C++ support and Android Runtime
respectively
Android Framework (API Layer)
It provides a structured set of APIs (Application
Programming Interfaces) that developers use to build
Android apps. It simplifies app development by
abstracting low-level system details and offers reusable
services and components.
Key Components
1. Activity Manager:
Manages the lifecycle and back stack of all activities in the application
Ensures that system resources are used efficiently by pausing or stopping unused
activities.
2. Content Providers:
Facilitates sharing of structured data between applications.
3. Notification Manager:
Handles Notifications shown in the status bar even when the app is not being used.
4. Package Manager:
Handles installation, updates and removal of apps on the device.
5. Clipboard Manager:
Provides the API for copy-paste text and other data across applications
Other components include: View system, Telephony Manager, Media Framework, Location
Manager, etc.
Application Layer
This is the most top layer of the Android architecture. It
represents everything that the user interacts with on
their device.
Types of Applications
1. Inbuilt apps:
These are core apps that come pre-installed on Android
devices and showcase the platforms capabilities.
Examples include:
Phone: used for making calls
Messages: Used for SMS and MMS
Browser: Used for web browsing.

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.

· Secondary Language: Java


· Historically the default language for
Android development.
Development Tools
1. Android Studio (Official IDE):
· Code editor, emulator, debugger, layout
editor.
· Gradle for builds and dependency
management.

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.

4. Resources (res folder):


· drawable: Images and graphics.
· layout: UI XML files.
· values: Strings, colors, dimensions, etc.
1. Activities: Single screen with UI (e.g.,
login screen).

2. Services: Perform background tasks


Android
(e.g., downloading files).
Application
Components 3. Content Providers: Share data between
apps (e.g., Contacts app).

4. Broadcast Receivers: Respond to


system-wide events (e.g., low battery
alerts).
App Lifecycle

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

You might also like