Android and Its Architecture
Android and Its Architecture
2
Cont.
• Mainly designed for touchscreen devices
• It supports different platforms
• 32-bit and 64-bit ARM
• Available in more than 100 languages
3
Versions of Android
Version Name Version Number Release Date
Android 1.0 1.0 2008
Android 1.1 1.1 2009
Cupcake 1.5 2009
Donut 1.6 2009
Eclair 2.* 2009-2010
… … …
Jelly Bean 4.1 2012
Kitkat 4.4 2013
Lollipop 5.0 2017
Marshmallow 6.0 2018
… … …
Vanilla Ice Cream 15 2024
4
5
Architecture of Android
• 5 functional parts
• Applications
• Application Framework
• Android Runtime
• Platform Libraries
• Linux Kernel
6
Let’s discuss the
functional parts in brief
7
Applications
• Top most layer of the architecture
• Includes pre-installed applications
• Home
• Gallery
• Contacts
•…
• Runs within Android runtime with the help of Application framework
8
Application Framework
• Provides services to create classes
• These classes help to create applications
• Provides a generic abstraction to access hardware
• Helps in managing UI with resources
9
Cont.
• Includes different service activity manager
• Activity manager
• Notification manager
• View system
• Package manager
•…
10
Android Runtime
• Contains core libraries and runs apps on Dalvik Virtual Machine
(DVM) or Application Runtime (often referred to as Android Runtime)
• A basement for the application framework
• Powers the applications layer with core libraries where developers
can write programs in Java
11
Dalvik Virtual Machine (DVM)
• It was an integral part of Android OS prior to version 5.0
• Specially designed to run apps with low resources (memory,
battery,…)
• Initially used Just-In-Time (JIT) compilation
• It was designed for memory efficiency
• Used garbage collector
12
Application Runtime/Android Runtime
Itself (ART)
• A successor of DVM
• Devices running in version 5.0 and higher, each app runs in its own
process and with its own instance of the Android Runtime (ART)
• It enables to run multiple virtual machines on low-memory devices
• Executes Dalvik Executable format (DEX) which is a bytecode format (more
human-readable format than machine code)
13
Cont.
• Ahead-of-time (AOT) and Just-in-time (JIT) compilation
• AOT compilation means translating full code to machine code before
executing the program
• It converts Java code into Dalvik bytecode
• JIT compilation means translating the part of the code into machine code on
demand
• It is used with AOT compilation to optimize performance
14
Cont.
• Optimized garbage collection
• Reduced battery consumption
• On Android 9 and higher, converts DEX files to more compact machine
code
• Better debugging support with a dedicated sampling profiler
• Detailed diagnostic exceptions and crash reporting
15
16
Platform Libraries
• Many core Android components and services require native C/C++
libraries
• OpenGL
• Native languages can be included directly
• The Android platform also provides Java API to access native libraries
• OpenGL ES can be accessed by Java OpenGL API
17
Cont.
• It also includes Java-based libraries
• Example of libraries:
• Media: supports audio and video
• Surface Manager: responsible for access to display subsystems
• OpenGL: for 2D, 3D graphics
• SQLite: for database support
•…
18
Using NDK to Support Libraries
• Development in C/C++, and Python is possible through Native
Development Kit (NDK)
• NDK is used when requires high-performance, low-level system
interaction with hardware
• Native code (C/C++) directly runs on the device’s CPU
• Native code performs better for certain tasks:
• Graphics rendering
• Signal processing
19
Linux Kernel
• Heart of the Android architecture
• Provides abstraction layer between hardware and other components
• Manages all the drivers
• Display
• Memory
• Audio
•…
20
Features of Linux Kernel
• Security
• Ensures security between apps and the system
• Memory management
• Effectively manages memory
• Provides freedom to develop apps
• Process management
• Allocates resources for processes
21
Cont.
• Network Stack
• Handles the network communication
• Driver model
• Ensures proper working procedure of apps
22
Android Boot Process
• Power On
• Begins the boot process
• Bootloader (Boot ROM)
• Initially runs the bootloader
• Bootloader Modes
• Depends on user actions (Recovery mode, Fast Boot mode,…)
23
Cont.
• Loading Boot Image
• Bootloader loads the boot image
• Contains Kernel (for hardware resources) and initial RAM disk (initrd)
• Kernel Initialization
• Initializes the hardware, mounts root file systems, and starts Android Init
process
• Starting Android Services
• Init process starts SurfaceFlinger (for graphics), Zygote (for apps, UI),…
24
Cont.
• Launching UI
• Zygote launches the Android system server that manages services and UI
• UI is loaded and displayed on the screen
• Completion
• Android system broadcasts a “boot completed” signal
25
26
References
• https://www.geeksforgeeks.org/android-architecture/
• https://developer.android.com/guide/platform
27
Question
• Can you differentiate DVM and ART?
28
Thank You
29