SlideShare a Scribd company logo
1 of 27
1
Introduction of Android
Architecture
2
Agenda
• Introduction
• Android Architecture
3
• Open source attracts talent across the world.
• Apache license protects OEM’s business.
• Easy to use language and stable API improve
developer’s interest.
• Compatibility protects
Android’s Integrity.
• Rich Apps inspire
users’ interesting.
• GMS and data protect
Google’s interest.
Ecosystem
4
Architecture
5
Android Architecture
• Application
• SDK & NDK
• Framework & Runtime
• Hal
Application
SDK interface layer
Framework, Runtime and Libraries
Hal interface layer
HAL
Kernel
IPC
IPC
6
APK Structure
7
Four Components
8
Four Components
Activity
Content
Resolver
Broadcast
Reciever
Activity
Content
Resolver
Broadcast
Reciever
Service
Content
Resolver
Broadcast
Reciever
Activity
Content
Provider
Sqlite Data and XML
Application 1
Application 2
Application 3
Send broadcast
Bind or start
Service using IntentSend broadcast
to system
Filter intent by
intent filter
9
Activity Life Cycle
10
Android Architecture
• Application
• SDK & NDK
• Framework & Runtime
• Hal
Application
SDK interface layer
Framework, Runtime and Libraries
Hal interface layer
HAL
Kernel
IPC
IPC
11
SDK & NDK
• SDK API
 Android.*
 Dalvik.*
 Java.*
 Javax.*
• Soft API
 Permissions
 Build Parameters
 Intent
• NDK
libaaudio.so, libandroid.so, libz, JNI interface, libc,
libcamera2ndk.so, libdl, libEGL.so, libGLESv2.so, libGLESv3.so,
libicuuc.so, libjnigraphics.so, libm.so, libRS.so, libstdc++,
libvulkan.so …
SDK interface layer
Framework
Application
SDK interface layer
Application
IPC IPC
Client
Sever Function service Function service
12
Android Architecture
• Application
• SDK & NDK
• Framework & Runtime
• Hal
Application
SDK interface layer
Framework, Runtime and Libraries
Hal interface layer
HAL
Kernel
IPC
IPC
13
Framework – Type of Services
Service Type Example Process Function Crash
recovery
System Java
Services
AMS/PMS/UMS/W
MS/DMS/CMS/LMS
/…
SystemServer Provide critical
system services
Restart by
system
System Native
Services
MediaServer/Rild/A
udioflinger/surfacefli
nger/logd/adbd/deb
uggerd/..
Dedicated
process
Provide critical
system services
Restart by
system
APK Services KeyGuardServices Dedicated
process
Provide
application level
services
Restart by
app itself.
14
System Services Register and Query
Running in different
processes
ServiceManager
AMS UMS PMS WMS
DMS CMS LMS ...
adbd debuggerd rild logd
mediaserv
er
surfaceflin
ger
audiofling
er
Native service Daemons
Java system services
Client
Components
1 AddService(IPC)
2 getService(IPC)
3 Call the service
provied by UMS
Running in system
server process
15
APK1
Client
Components
2 Send Intent to
start or bind a
service
APK2
ServiceRecor
d List
PackageManager
Service
SystemServer
3 Call the service
provied by APK1
APK services Register and Query
APK will define some
filter to declare which
intent its services will
proceed.
1 PMS will parser all
APK when it is
installed or system
boot time to get
services information
APK will define some
filter to declare which
intent its services will
proceed.
PMS will be
responsible for start
APK1 if APK1 is not
started
16
Bionic
• Developed by Google
• BSD license
• Faster and smaller
• No compatibility with GUN libc
• Special function for Android, such as getprop
17
DALVIK vs ART
• Installation Time
• Storage Usage
• Performance
• Battery
18
Memory –Native Allocator
Application
System Runtime
System Kernel
Memory Allocator
Process Virtual Address Space Map Area Heap Area
malloc/calloc/realloc
Unit Unit
Unit Unit
brk/sbrkmmap/munmap
free
19
Hybrid JIT/AOT
20
From Java Method to Native Method
Function type
info is stored in
Dex/OAT file
21
Process and Thread
Java APK NDK APK
zygote Java process
Native
Daemon
Framework
App
·
Thread
·
Thread
·
·
·
Fork
Process ProcessProcessProcess
Fork
Process
22
System Boot up
Will parser init.rc to
start all daemons
and zygote
Partitions will be
mounted and verified
one by one
Init process creates
daemons according
to some stages: init-
>boot->fs->data
23
Init
Fork
Start Linker
Load ELF and
depended lib
Zygote Process
Create
Heap
Init Art Vm in
libart.so
Create
Threads
Start Jit
Start GC Preload classes
Preload drawable
resource
Preload libraries
Enter loop to wait
for incoming
request
Fork request to
start system server
Split heap into two
heaps named
zygote and active
Start First Java Process - Zygote
Create one heap
named zygote using
Ashmem
First fork request will trigger
the heap split action to
improve GC performance
3000+ class and 400+
drawable will be loaded
in zygote so that they
can be shared across
all java processes
Create GC and other
threads
24
Android Architecture
• Application
• SDK & NDK
• Framework & Runtime
• Hal
Application
SDK interface layer
Framework, Runtime and Libraries
Hal interface layer
HAL
Kernel
IPC
IPC
25
HAL Treble Arch
26
HAL Treble Evolvement
27
Sensor
client
Vibrat
or c
Power
client
Init
ServiceManager
Zygote
System_server
vold
sufaceflinger
mediaserver
client
client
Sensor hal
process
HALServiceManag
er
Power hal process
audio hal process
IPC
IPC
IPC
HAL Treble Detailed Architecture
HalServiceManger will
be responsible for
maintaining all Hal
service
IPC is used to
communicate
from Hal Client
to Hal Service

More Related Content

What's hot

What's hot (20)

SRE principles and (Kubernetes) Operator practice | DevNation Tech Talk
SRE principles and (Kubernetes) Operator practice | DevNation Tech TalkSRE principles and (Kubernetes) Operator practice | DevNation Tech Talk
SRE principles and (Kubernetes) Operator practice | DevNation Tech Talk
 
DevOps with OpenShift - Fabien Dupont - ManageIQ Design Summit 2016
DevOps with OpenShift - Fabien Dupont - ManageIQ Design Summit 2016DevOps with OpenShift - Fabien Dupont - ManageIQ Design Summit 2016
DevOps with OpenShift - Fabien Dupont - ManageIQ Design Summit 2016
 
Diving Through The Layers: Investigating runc, containerd, and the Docker eng...
Diving Through The Layers: Investigating runc, containerd, and the Docker eng...Diving Through The Layers: Investigating runc, containerd, and the Docker eng...
Diving Through The Layers: Investigating runc, containerd, and the Docker eng...
 
Devops.pptx
Devops.pptxDevops.pptx
Devops.pptx
 
Continious integration pipeline
Continious integration pipelineContinious integration pipeline
Continious integration pipeline
 
はじめての JFrog Artifactory
はじめての JFrog Artifactoryはじめての JFrog Artifactory
はじめての JFrog Artifactory
 
Meetup Openshift Geneva 03/10
Meetup Openshift Geneva 03/10Meetup Openshift Geneva 03/10
Meetup Openshift Geneva 03/10
 
Automating the Quality
Automating the QualityAutomating the Quality
Automating the Quality
 
Put the dev back in devops - Cloud-native at local speed! - RH Summit 19
Put the dev back in devops - Cloud-native at local speed! - RH Summit 19Put the dev back in devops - Cloud-native at local speed! - RH Summit 19
Put the dev back in devops - Cloud-native at local speed! - RH Summit 19
 
Diagnose Your Microservices
Diagnose Your MicroservicesDiagnose Your Microservices
Diagnose Your Microservices
 
Git for IBM Notes Designer
Git for IBM Notes DesignerGit for IBM Notes Designer
Git for IBM Notes Designer
 
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18Openshift: The power of kubernetes for engineers - Riga Dev Days 18
Openshift: The power of kubernetes for engineers - Riga Dev Days 18
 
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
Podman, Buildah, and Quarkus - The Latest in Linux Containers Technologies
 
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech TalkArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
ArgoCD and Tekton: Match made in Kubernetes heaven | DevNation Tech Talk
 
WSO2 Kubernetes Reference Architecture - Nov 2017
WSO2 Kubernetes Reference Architecture - Nov 2017WSO2 Kubernetes Reference Architecture - Nov 2017
WSO2 Kubernetes Reference Architecture - Nov 2017
 
SBG Infrastructure Tools
SBG Infrastructure ToolsSBG Infrastructure Tools
SBG Infrastructure Tools
 
Continuous Integration and Deployment with Jenkins for PCF
Continuous Integration and Deployment with Jenkins for PCFContinuous Integration and Deployment with Jenkins for PCF
Continuous Integration and Deployment with Jenkins for PCF
 
TYPO3 & Composer
TYPO3 & ComposerTYPO3 & Composer
TYPO3 & Composer
 
Build and run applications in a dockerless kubernetes world
Build and run applications in a dockerless kubernetes worldBuild and run applications in a dockerless kubernetes world
Build and run applications in a dockerless kubernetes world
 
Red Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABCRed Hat OpenShift Operators - Operators ABC
Red Hat OpenShift Operators - Operators ABC
 

Similar to Introduction of Android Architecture

Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
Joe Jacob
 
Android and Hard Real Time
Android and Hard Real TimeAndroid and Hard Real Time
Android and Hard Real Time
Akshar Desai
 
3. Android Architecture.pptx
3. Android Architecture.pptx3. Android Architecture.pptx
3. Android Architecture.pptx
HarshiniB11
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
QAware GmbH
 

Similar to Introduction of Android Architecture (20)

CNIT 128 6. Analyzing Android Applications (Part 1)
CNIT 128 6. Analyzing Android Applications (Part 1)CNIT 128 6. Analyzing Android Applications (Part 1)
CNIT 128 6. Analyzing Android Applications (Part 1)
 
Android - Application Framework
Android - Application FrameworkAndroid - Application Framework
Android - Application Framework
 
Learn more about the tremendous value Open Data Plane brings to NFV
Learn more about the tremendous value Open Data Plane brings to NFVLearn more about the tremendous value Open Data Plane brings to NFV
Learn more about the tremendous value Open Data Plane brings to NFV
 
Open Source In The World Of Java
Open Source In The World Of JavaOpen Source In The World Of Java
Open Source In The World Of Java
 
Introduction to android sessions new
Introduction to android   sessions newIntroduction to android   sessions new
Introduction to android sessions new
 
My androidpresentation
My androidpresentationMy androidpresentation
My androidpresentation
 
Embedded Fest 2019. Іван Пустовіт. From AOSP to Android powered device
Embedded Fest 2019. Іван Пустовіт. From AOSP to Android powered deviceEmbedded Fest 2019. Іван Пустовіт. From AOSP to Android powered device
Embedded Fest 2019. Іван Пустовіт. From AOSP to Android powered device
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
OSGi on Google Android using Apache Felix
OSGi on Google Android using Apache FelixOSGi on Google Android using Apache Felix
OSGi on Google Android using Apache Felix
 
The Twelve Factor App - Pivotal Tracker
The Twelve Factor App - Pivotal TrackerThe Twelve Factor App - Pivotal Tracker
The Twelve Factor App - Pivotal Tracker
 
Android and Hard Real Time
Android and Hard Real TimeAndroid and Hard Real Time
Android and Hard Real Time
 
Lick my Lollipop
Lick my LollipopLick my Lollipop
Lick my Lollipop
 
Gocd – Kubernetes/Nomad Continuous Deployment
Gocd – Kubernetes/Nomad Continuous DeploymentGocd – Kubernetes/Nomad Continuous Deployment
Gocd – Kubernetes/Nomad Continuous Deployment
 
3. Android Architecture.pptx
3. Android Architecture.pptx3. Android Architecture.pptx
3. Android Architecture.pptx
 
LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2LCU14 310- Cisco ODP v2
LCU14 310- Cisco ODP v2
 
Enhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_osEnhancing and modifying_the_core_android_os
Enhancing and modifying_the_core_android_os
 
The tools & technologies behind Resin.io
The tools & technologies behind Resin.ioThe tools & technologies behind Resin.io
The tools & technologies behind Resin.io
 
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
Kubernetes One-Click Deployment: Hands-on Workshop (Mainz)
 
MDAD 2 - Introduction to the Android Framework
MDAD 2 - Introduction to the Android FrameworkMDAD 2 - Introduction to the Android Framework
MDAD 2 - Introduction to the Android Framework
 
Android Lollipop
Android LollipopAndroid Lollipop
Android Lollipop
 

More from Bin Yang (6)

New features in android m upload
New features in android m   uploadNew features in android m   upload
New features in android m upload
 
Android ressource and overlay upload
Android ressource and overlay   uploadAndroid ressource and overlay   upload
Android ressource and overlay upload
 
Android secuirty permission - upload
Android secuirty   permission - uploadAndroid secuirty   permission - upload
Android secuirty permission - upload
 
Linker and loader upload
Linker and loader   uploadLinker and loader   upload
Linker and loader upload
 
Update from android kk to android l
Update from android kk to android lUpdate from android kk to android l
Update from android kk to android l
 
Google IO 2014 overview
Google IO 2014 overviewGoogle IO 2014 overview
Google IO 2014 overview
 

Recently uploaded

Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Cara Menggugurkan Kandungan 087776558899
 

Recently uploaded (8)

FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCRFULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
FULL ENJOY - 9999218229 Call Girls in {Mahipalpur}| Delhi NCR
 
Leading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdfLeading Mobile App Development Companies in India (2).pdf
Leading Mobile App Development Companies in India (2).pdf
 
Android Application Components with Implementation & Examples
Android Application Components with Implementation & ExamplesAndroid Application Components with Implementation & Examples
Android Application Components with Implementation & Examples
 
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
9999266834 Call Girls In Noida Sector 52 (Delhi) Call Girl Service
 
Mobile Application Development-Components and Layouts
Mobile Application Development-Components and LayoutsMobile Application Development-Components and Layouts
Mobile Application Development-Components and Layouts
 
Mobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s ToolsMobile Application Development-Android and It’s Tools
Mobile Application Development-Android and It’s Tools
 
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
Obat Penggugur Kandungan Di Apotik Kimia Farma (087776558899)
 
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
Thane 💋 Call Girls 7738631006 💋 Call Girls in Thane Escort service book now. ...
 

Introduction of Android Architecture

  • 3. 3 • Open source attracts talent across the world. • Apache license protects OEM’s business. • Easy to use language and stable API improve developer’s interest. • Compatibility protects Android’s Integrity. • Rich Apps inspire users’ interesting. • GMS and data protect Google’s interest. Ecosystem
  • 5. 5 Android Architecture • Application • SDK & NDK • Framework & Runtime • Hal Application SDK interface layer Framework, Runtime and Libraries Hal interface layer HAL Kernel IPC IPC
  • 8. 8 Four Components Activity Content Resolver Broadcast Reciever Activity Content Resolver Broadcast Reciever Service Content Resolver Broadcast Reciever Activity Content Provider Sqlite Data and XML Application 1 Application 2 Application 3 Send broadcast Bind or start Service using IntentSend broadcast to system Filter intent by intent filter
  • 10. 10 Android Architecture • Application • SDK & NDK • Framework & Runtime • Hal Application SDK interface layer Framework, Runtime and Libraries Hal interface layer HAL Kernel IPC IPC
  • 11. 11 SDK & NDK • SDK API  Android.*  Dalvik.*  Java.*  Javax.* • Soft API  Permissions  Build Parameters  Intent • NDK libaaudio.so, libandroid.so, libz, JNI interface, libc, libcamera2ndk.so, libdl, libEGL.so, libGLESv2.so, libGLESv3.so, libicuuc.so, libjnigraphics.so, libm.so, libRS.so, libstdc++, libvulkan.so … SDK interface layer Framework Application SDK interface layer Application IPC IPC Client Sever Function service Function service
  • 12. 12 Android Architecture • Application • SDK & NDK • Framework & Runtime • Hal Application SDK interface layer Framework, Runtime and Libraries Hal interface layer HAL Kernel IPC IPC
  • 13. 13 Framework – Type of Services Service Type Example Process Function Crash recovery System Java Services AMS/PMS/UMS/W MS/DMS/CMS/LMS /… SystemServer Provide critical system services Restart by system System Native Services MediaServer/Rild/A udioflinger/surfacefli nger/logd/adbd/deb uggerd/.. Dedicated process Provide critical system services Restart by system APK Services KeyGuardServices Dedicated process Provide application level services Restart by app itself.
  • 14. 14 System Services Register and Query Running in different processes ServiceManager AMS UMS PMS WMS DMS CMS LMS ... adbd debuggerd rild logd mediaserv er surfaceflin ger audiofling er Native service Daemons Java system services Client Components 1 AddService(IPC) 2 getService(IPC) 3 Call the service provied by UMS Running in system server process
  • 15. 15 APK1 Client Components 2 Send Intent to start or bind a service APK2 ServiceRecor d List PackageManager Service SystemServer 3 Call the service provied by APK1 APK services Register and Query APK will define some filter to declare which intent its services will proceed. 1 PMS will parser all APK when it is installed or system boot time to get services information APK will define some filter to declare which intent its services will proceed. PMS will be responsible for start APK1 if APK1 is not started
  • 16. 16 Bionic • Developed by Google • BSD license • Faster and smaller • No compatibility with GUN libc • Special function for Android, such as getprop
  • 17. 17 DALVIK vs ART • Installation Time • Storage Usage • Performance • Battery
  • 18. 18 Memory –Native Allocator Application System Runtime System Kernel Memory Allocator Process Virtual Address Space Map Area Heap Area malloc/calloc/realloc Unit Unit Unit Unit brk/sbrkmmap/munmap free
  • 20. 20 From Java Method to Native Method Function type info is stored in Dex/OAT file
  • 21. 21 Process and Thread Java APK NDK APK zygote Java process Native Daemon Framework App · Thread · Thread · · · Fork Process ProcessProcessProcess Fork Process
  • 22. 22 System Boot up Will parser init.rc to start all daemons and zygote Partitions will be mounted and verified one by one Init process creates daemons according to some stages: init- >boot->fs->data
  • 23. 23 Init Fork Start Linker Load ELF and depended lib Zygote Process Create Heap Init Art Vm in libart.so Create Threads Start Jit Start GC Preload classes Preload drawable resource Preload libraries Enter loop to wait for incoming request Fork request to start system server Split heap into two heaps named zygote and active Start First Java Process - Zygote Create one heap named zygote using Ashmem First fork request will trigger the heap split action to improve GC performance 3000+ class and 400+ drawable will be loaded in zygote so that they can be shared across all java processes Create GC and other threads
  • 24. 24 Android Architecture • Application • SDK & NDK • Framework & Runtime • Hal Application SDK interface layer Framework, Runtime and Libraries Hal interface layer HAL Kernel IPC IPC
  • 27. 27 Sensor client Vibrat or c Power client Init ServiceManager Zygote System_server vold sufaceflinger mediaserver client client Sensor hal process HALServiceManag er Power hal process audio hal process IPC IPC IPC HAL Treble Detailed Architecture HalServiceManger will be responsible for maintaining all Hal service IPC is used to communicate from Hal Client to Hal Service

Editor's Notes

  1. Portability Easy Update Multiple products support Car IVI Android Auto Android TV Android wear Tablet Phone