ANDROID ARCHITECTURE
Compiled BY: Miss KIRAN AYUB
Compiled By : Miss Kiran Ayub 1
Compiled By : Miss Kiran Ayub 2
Previous Versions
Unnamed (1.0 + 1.1) (Alpha, Beta)
Cupcake (1.5)
Donut (1.6) – Quick Search Box
Éclair (2.1) – High Density Displays, Traffic + Navigation
Froyo (2.2) – Voice Control, Hotspot, Speed
Gingerbread (2.3) – Simpler, Battery Life, More apps
Honeycomb (3.0) – Flexible interface, tablets
Ice Cream Sandwich (4.0) - Customization
Jelly Bean (4.1) – Google Now, actionable notifications
KitKat (4.4) – “Ok Google”, voice control variety
Lollipop (5.0) – fluid tactile screens
Marshmallow (6.0) – battery life, app permissions, UI
Nougat(7.0)- ability to display multiple apps on-screen at once in a split-screen view, support for inline replies to
notifications
Oreo(8.0)- Do two things at once , improve battery life, auto fill
Compiled By : Miss Kiran Ayub 3
What is Android?
Android is an open-source software stack for mobile devices
Is a platform which consist of
Operating system
Middleware
Key application
Compiled By : Miss Kiran Ayub 4
Key
Application
Middle ware
Operating
System
Compiled By : Miss Kiran Ayub 5
Compiled By : Miss Kiran Ayub 6
Libc:c standard library
SSL: Secure Socket Layer
Surface Manager:
responsible for
composing different
drawing surfaces onto the
screen.
OpenGL|ES : 3D Image Engine
SGL : 2D image Engine.
Hence we can combine 3D and 2D graphics in the same application.
Media Framework : Core part of the android multimedia.
MPEG4,H264,MP3,AAC…..
FreeType: To render the fonts.
WebKit:open source browser engine. Helps to work well on small screen.
SQLite: Embedded Database
Compiled By : Miss Kiran Ayub 7
Linux Kernel
Any electronic device which consist of two things
Hardwar component
software component.
There is a middle layer between s/w and h/w component that interact
hardware component with software component , that middle layer is nothing
but an OS.
In android system that OS is Linux kernel.
Compiled By : Miss Kiran Ayub 8
Linux Kernel
The main functionality of this OS is:
Memory management
Resource management
Drivers management
Power management.
Compiled By : Miss Kiran Ayub 9
Linux Kernel
Built on top of Linux kernel Advantages:
Portability (i.e. easy to compile on different
hardware architectures)
Security (e.g. secure multi-process environment)
Power Management
ART relies on the kernel for threads and memory
management
Manufacturers build on top of a reliable kernel
Each application has its own User ID (UID)
Sandbox
Compiled By : Miss Kiran Ayub 10
Hardware Abstraction Layer (HAL)
Java API’s is use to HAL to interact with the Hardware
Compiled By : Miss Kiran Ayub 11
Hardware Abstraction Layer (HAL)
Android HAL allows the Android application/framework to communicate with
the hardware specific device drivers.
Android HAL (in abstract) bridges the gap between hardware and software.
Android application/framework communicates with the underlying hardware
through Java APIs not by system calls.
But the Linux has the ability to handle only systems calls from application.
Thus we need a glue layer between the android framework and linux system.
For Android application, HAL provides API’s through which service can place a
request to device.
And HAL uses functions provided by the lower layer Linux system to serve the
request from the android framework.
Compiled By : Miss Kiran Ayub 12
ART Android Runtime
Java Virtual Machine implementation
Optimized for memory-constrained devices
Faster than Oracle JVM
ART optional from 4.4, mandatory from 5.0
Starting from Android 5.0,
ART is used instead of Dalvik
Designed to run multiple VM on low end devices
Runs DEX bytecode
Compiled By : Miss Kiran Ayub 13
Dalvik VM
• All applications written in Java are converted to the dalvik executable
.dex
• Every android app runs its own process, with its own instance of the dalvik
virtual machine
• Not a traditional JVM, but a custom VM designed to run multiple instances
efficiently on a single device
• VM uses linux kernel to handle low-level functionality incl. security,
threading, process and memory management
Compiled By : Miss Kiran Ayub 14
Dalvik Java Virtual Machine (JVM)
Java Java
Source Source
Code Code
Java Java
Compiler Compiler
Java Byte Java Byte
Code Code
.class file .class file
Dex
Compiler
Dalvik Byte
Code
.dex
Java ByteCode Dalvik Executable
Java Virtual Machine (JVM) Dalvik Virtual Machine (VM)
Compiled By : Miss Kiran Ayub 15
Dalvik Java Virtual Machine (JVM)
Java Java
Source Source
Code Code
Java Java
Compiler Compiler
Java Byte Java Byte
Code Code
.class file .class file
Dex
Compiler
Dalvik Byte
Code
.dex
Java ByteCode Dalvik Executable
Java Virtual Machine (JVM) Android RunTime
Compiled By : Miss Kiran Ayub 16
Compiled By : Miss Kiran Ayub 17
Android Runtime ART
Option to use DVM/ ART
DVM interpreted at run time
ART- Compiled to Native Code
ART- Much Faster than DVM
Compiled By : Miss Kiran Ayub 18
Native Libraries
Graphics (Surface Manager)
Multimedia (Media Framework)
Database DBMS (SQLite)
Font Management (FreeType)
WebKit
C libraries
OpenMAX AL
(open media acceleration Application Layer)
Compiled By : Miss Kiran Ayub 19
Native Library
If we writing a code in java programming language .we need to import some
java libraries like:
[Link].*
[Link].*
By using java we can’t interact with some low level media components.
Like displaying graphics , which is not possible in java.
For this purpose we need some native methods, by using these methods the
java code is going to interact with some other programming languages , that
languages is called native libraries
Compiled By : Miss Kiran Ayub 20
Native Library
Example:
In android we display graphics by using OpenGL ES(Open Graphic library for
Embedded Systems )which is one of the native library .
The java code is going to interact with OpenGL ES code to display graphics
Compiled By : Miss Kiran Ayub 21
Android NDK
Enables C/C++ coding
Useful if you want to interact/extend with some native libraries
Performance
Reuse your C/C++ libraries
JAVA APIs are provided for most used libraries
NDK can be installed as an Android Studio plugin
Compiled By : Miss Kiran Ayub 22
Application Framework
What is responsibility of App. Framework
It make easy to develop any application
It provides readymade libraries.
You don’t need write a huge amount of code.
Provide a manger class for different purpose like Bluetooth manger, wife manager,
location manager,
Compiled By : Miss Kiran Ayub 23
Android Application/ System App.
By using Java ,C/C++ .net we can develop android application
Java (sdk = system development kit)
C/C++ (NDK= native development kit)
.net (Mono android framework)
KOTLIN
Google is adding Kotlin as an official programming language for Android
development
Compiled By : Miss Kiran Ayub 24
Compiled By : Miss Kiran Ayub 25