SlideShare a Scribd company logo
Android	
  
 Internals	
  


Marko	
  Gargenta	
  
  Marakana	
  
Agenda	
  
•    Android	
  Stack	
  
•    Opera6ng	
  System	
  Features	
  
•    Android	
  Startup	
  &	
  Run6me	
  
•    Layer	
  Interac6on	
  
•    Na6ve	
  Development	
  Kit	
  
•    Summary	
  
ANDROID	
  STACK	
  
The	
  Stack	
  
Linux	
  Kernel	
  
Android runs on Linux.                                        Applications


                                    Home      Contacts          Phone             Browser              Other

Linux provides as well as:
    Hardware abstraction layer                            Application Framework
    Memory management              Activity        Window                    Content                   View

    Process management
                                   Manager         Manager                  Providers                 System

                                   Package    Telephony         Resource           Location            Notiication
    Networking                     Manager     Manager          Manager            Manager             Manager


                                                                Libraries
Users never see Linux sub system   Surface       Media
                                                                   SQLite                  Android Runtime
                                   Manager     Framework

                                                                                                 Core Libs

The adb shell command opens        OpenGL      FreeType            WebKit

                                                                                                  Delvik
Linux shell                          SGL          SSL               libc
                                                                                                   VM




                                    Display    Camera         Linux Kernel              Flash                Binder
                                    Driver      Driver                                  Driver               Driver

                                    Keypad      WiFi                                    Audio                Power
                                     Driver     Driver                                  Driver               Mgmt
Na6ve	
  Libraries	
  
Bionic, a super fast and small                              Applications


license-friendly libc library     Home      Contacts          Phone             Browser              Other

optimized for embedded use
                                                        Application Framework
Surface Manager for composing    Activity        Window                    Content                   View

window manager with off-screen   Manager         Manager                  Providers                 System


buffering
                                 Package    Telephony         Resource           Location            Notiication
                                 Manager     Manager          Manager            Manager             Manager


                                                              Libraries
2D and 3D graphics hardware      Surface       Media
                                                                 SQLite                  Android Runtime
support or software simulation
                                 Manager     Framework

                                                                                               Core Libs
                                 OpenGL      FreeType            WebKit

                                                                                                Delvik
Media codecs offer support for     SGL          SSL               libc
                                                                                                 VM

major audio/video codecs
                                  Display    Camera         Linux Kernel              Flash                Binder
                                                                                      Driver               Driver
SQLite database
                                  Driver      Driver

                                  Keypad      WiFi                                    Audio                Power
                                   Driver     Driver                                  Driver               Mgmt


WebKit library for fast HTML
rendering
Dalvik	
  
Dalvik VM is Google’s implementation of Java

Optimized for mobile devices




Key Dalvik differences:

    Register-based versus stack-based VM
    Dalvik runs .dex files
    More efficient and compact implementation
    Different set of Java libraries than SDK
Android	
  and	
  Java	
  

Android Java =
Java SE –
AWT/Swing +
Android API
Applica6on	
  Framework	
  
Activation manager controls the life                              Applications


cycle of the app                        Home      Contacts          Phone             Browser              Other




Content providers encapsulate data                            Application Framework
that is shared (e.g. contacts)         Activity        Window                    Content                   View
                                       Manager         Manager                  Providers                 System

                                       Package    Telephony         Resource           Location            Notiication
Resource manager manages               Manager     Manager          Manager            Manager             Manager


everything that is not the code                                     Libraries
                                       Surface       Media
                                                                       SQLite                  Android Runtime
                                       Manager     Framework

Location manager figures out the                                                                     Core Libs

location of the phone (GPS, GSM,
                                       OpenGL      FreeType            WebKit

                                                                                                      Delvik

WiFi)                                    SGL          SSL               libc
                                                                                                       VM




Notification manager for events         Display
                                        Driver
                                                   Camera
                                                    Driver
                                                                  Linux Kernel              Flash
                                                                                            Driver
                                                                                                                 Binder
                                                                                                                 Driver

such as arriving messages,              Keypad      WiFi                                    Audio
                                                                                            Driver
                                                                                                                 Power
                                                                                                                 Mgmt
                                         Driver     Driver
appointments, etc
Applica6ons	
  
OPERATING	
  SYSTEM	
  FEATURES	
  	
  
File	
  System	
  
The file system has three main mount points. One
for system, one for the apps, and one for whatever.

Each app has its own sandbox easily accessible to
it. No one else can access its data. The sandbox is
in /data/data/com.marakana/

SDCard is expected to always be there. It’s a good
place for large files, such as movies and music.
Everyone can access it.
Security	
  
Each Android application            Android Application
runs inside its own Linux
process.                                     Linux Process
Additionally, each application
has its own sandbox file                                   File
system with its own set of                     Prefs
                                       DB                 System
preferences and its own
database.

Other applications cannot
access any of its data,
unless it is explicitly shared.
ANDROID	
  	
  
STARTUP	
  &	
  	
  
RUNTIME	
  
Startup	
  Walkthrough	
  
Run6me	
  Overview	
  
Layer	
  Interac6ons
                                     	
  
There are three main
scenarios for your app to talk
to native library:

-  Directly
-  Via native service
-  Via native daemon

It will depend on the type of
app and type of native library
which method works best.
App	
  –	
  Run6me	
  Service	
  -­‐	
  Lib	
  
App	
  –	
  Run6me-­‐Na6ve	
  Service-­‐Lib	
  
App–Run6me–Na6ve	
  Daemon-­‐Lib	
  
Binder	
  IPC	
  




High-performance IPC: shared memory, per-process thread pool, synchronous
Java	
  Na6ve	
  Interface	
  

JNI defines naming and coding
convention so that Java VM can find
and call native code.

JNI is built into JVM to provide
access to OS I/O and others.
Building	
  and	
  Running	
  JNI	
  Code	
  
NATIVE	
  
DEVELOPMENT	
  
KIT	
  
What’s	
  in	
  NDK?	
  
Tools to build and compile your native code for the device
architecture (such as ARM)


A way to package your library into the APK file so you can
distribute your application easily


A set of native system headers that will be supported for
the future releases of Android platform (libc, libm, libz,
liblog, JNI headers, some C++ headers, and OpenGL)



(some) documentation, sample code and examples
Why	
  NDK?	
  

NDK allows you to develop parts of your Android
application in C/C++.

You cannot develop native-only apps in NDK –
your app is still subject to security sandboxing.

Main motivation for native code is performance.
Using	
  NDK	
  
Summary	
  
     For most applications, you will just
     need Android SDK to develop apps.

     Sometimes you may need NDK to
     make parts of your app run faster.

     Ultimately, you can build your own
     Android platform from source.



     Marko Gargenta, Marakana.com
     marko@marakana.com
     +1-415-647-7000



     Licensed under Creative Commons
     License (cc-by-nc-nd). Please Share!

More Related Content

PPT
Ios development
PPTX
Android application development ppt
PPTX
Layer architecture of ios (1)
PPTX
Introduction to iOS Apps Development
PPTX
Android seminar ppt
PPTX
Introduction to SDN and NFV
PDF
How Secure Are Your APIs?
PPTX
2 mobile development frameworks and tools dark temp
Ios development
Android application development ppt
Layer architecture of ios (1)
Introduction to iOS Apps Development
Android seminar ppt
Introduction to SDN and NFV
How Secure Are Your APIs?
2 mobile development frameworks and tools dark temp

What's hot (20)

PDF
Android Automotive
PPTX
Virtualization And Containerization.pptx
PPTX
Understanding android security model
PDF
Introduction to Mobile Application Development
PPT
Exploring Openstack Swift(Object Storage) and Swiftstack
PPTX
VMware vSphere 6.0 - Troubleshooting Training - Day 4
PPTX
Binder: Android IPC
PPT
Android Security
PDF
Introduction to Firebase from Google
PPTX
IBM WebSphere Application Server version to version comparison
PDF
Introduction to Cloud | Cloud Computing Tutorial for Beginners | Cloud Certif...
PPTX
VMware vSphere technical presentation
PPTX
Presentation on Android application
PPTX
Cloud Service Models
PPTX
Day: 1 Introduction to Mobile Application Development (in Android)
PPT
Virtualization in cloud computing ppt
PDF
Openstack 101
PDF
OpenStack Swift
PDF
An Introduction to VMware NSX
Android Automotive
Virtualization And Containerization.pptx
Understanding android security model
Introduction to Mobile Application Development
Exploring Openstack Swift(Object Storage) and Swiftstack
VMware vSphere 6.0 - Troubleshooting Training - Day 4
Binder: Android IPC
Android Security
Introduction to Firebase from Google
IBM WebSphere Application Server version to version comparison
Introduction to Cloud | Cloud Computing Tutorial for Beginners | Cloud Certif...
VMware vSphere technical presentation
Presentation on Android application
Cloud Service Models
Day: 1 Introduction to Mobile Application Development (in Android)
Virtualization in cloud computing ppt
Openstack 101
OpenStack Swift
An Introduction to VMware NSX
Ad

Viewers also liked (20)

PDF
Android Services Black Magic by Aleksandar Gargenta
PDF
Behavior Driven Development
PDF
DABiS800
PDF
30 Band Marks
PDF
Mapa Mental
PPT
New concepts in human
PDF
Optimizing the Virtual Environment
PDF
Tranzeo
PDF
OutSys Company Presentation
PDF
Bloombase 为 KVM 企业级虚拟数据中心提供全方位信息安全保护及运算
PDF
Dematic Logistics Review #4
PPT
Tieto Enator
PDF
Guide to Investment: Republic of Tatarstan
PDF
Safend- DL
PDF
Estrategias y recursos i
PPT
E-group's pitch
 
PDF
Catalog Sew-Eurodrive
PPTX
History of the llano estacado
PPT
Desafios jurídicos de Internet
ODP
Girl, interrupted
Android Services Black Magic by Aleksandar Gargenta
Behavior Driven Development
DABiS800
30 Band Marks
Mapa Mental
New concepts in human
Optimizing the Virtual Environment
Tranzeo
OutSys Company Presentation
Bloombase 为 KVM 企业级虚拟数据中心提供全方位信息安全保护及运算
Dematic Logistics Review #4
Tieto Enator
Guide to Investment: Republic of Tatarstan
Safend- DL
Estrategias y recursos i
E-group's pitch
 
Catalog Sew-Eurodrive
History of the llano estacado
Desafios jurídicos de Internet
Girl, interrupted
Ad

Similar to Marakana Android Internals (20)

PDF
Android Internals
PDF
Android: A 9,000-foot Overview
PDF
Android for Java Developers at OSCON 2010
PDF
Android For Managers Slides
PDF
Android for Java Developers
PDF
Open Android
PDF
An Introduction To Android
PDF
Google Io Introduction To Android
PDF
Inside Android's Dalvik VM - NEJUG Nov 2011
PPTX
Android and Intel Inside
ODP
Android. behind the scenes_programatica 2012
PDF
Introduction of android
PDF
Google Android @ AlphaCSP's JavaEdge
PDF
Android application development
PDF
Android
PDF
MeeGo AppLab Desktop Summit 2011 - Submission and Validation
PDF
Google Android Naver 1212
PPTX
Android platform
PDF
The anatomy and philosophy of Android - Google I/O 2009
PDF
Mobile Showcase Moblin2
Android Internals
Android: A 9,000-foot Overview
Android for Java Developers at OSCON 2010
Android For Managers Slides
Android for Java Developers
Open Android
An Introduction To Android
Google Io Introduction To Android
Inside Android's Dalvik VM - NEJUG Nov 2011
Android and Intel Inside
Android. behind the scenes_programatica 2012
Introduction of android
Google Android @ AlphaCSP's JavaEdge
Android application development
Android
MeeGo AppLab Desktop Summit 2011 - Submission and Validation
Google Android Naver 1212
Android platform
The anatomy and philosophy of Android - Google I/O 2009
Mobile Showcase Moblin2

More from Marko Gargenta (11)

PDF
LTE: Building New Killer Apps
PDF
Java Champion Wanted
PDF
Android Beyond The Phone
PDF
Android Internals
PDF
Android Deep Dive
PDF
Marakana Android User Interface
PDF
Marakana android-java developers
PDF
Scrum Overview
ODP
Why Python by Marilyn Davis, Marakana
PDF
Jens Østergaard on Why Scrum Is So Hard
PDF
Jens Østergaard on Why Scrum Is So Hard
LTE: Building New Killer Apps
Java Champion Wanted
Android Beyond The Phone
Android Internals
Android Deep Dive
Marakana Android User Interface
Marakana android-java developers
Scrum Overview
Why Python by Marilyn Davis, Marakana
Jens Østergaard on Why Scrum Is So Hard
Jens Østergaard on Why Scrum Is So Hard

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PPTX
Spectroscopy.pptx food analysis technology
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
cuic standard and advanced reporting.pdf
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
sap open course for s4hana steps from ECC to s4
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Electronic commerce courselecture one. Pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
“AI and Expert System Decision Support & Business Intelligence Systems”
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Encapsulation_ Review paper, used for researhc scholars
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Understanding_Digital_Forensics_Presentation.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Spectroscopy.pptx food analysis technology
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
NewMind AI Weekly Chronicles - August'25 Week I
cuic standard and advanced reporting.pdf
Dropbox Q2 2025 Financial Results & Investor Presentation
sap open course for s4hana steps from ECC to s4
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Electronic commerce courselecture one. Pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Advanced methodologies resolving dimensionality complications for autism neur...

Marakana Android Internals

  • 1. Android   Internals   Marko  Gargenta   Marakana  
  • 2. Agenda   •  Android  Stack   •  Opera6ng  System  Features   •  Android  Startup  &  Run6me   •  Layer  Interac6on   •  Na6ve  Development  Kit   •  Summary  
  • 5. Linux  Kernel   Android runs on Linux. Applications Home Contacts Phone Browser Other Linux provides as well as: Hardware abstraction layer Application Framework Memory management Activity Window Content View Process management Manager Manager Providers System Package Telephony Resource Location Notiication Networking Manager Manager Manager Manager Manager Libraries Users never see Linux sub system Surface Media SQLite Android Runtime Manager Framework Core Libs The adb shell command opens OpenGL FreeType WebKit Delvik Linux shell SGL SSL libc VM Display Camera Linux Kernel Flash Binder Driver Driver Driver Driver Keypad WiFi Audio Power Driver Driver Driver Mgmt
  • 6. Na6ve  Libraries   Bionic, a super fast and small Applications license-friendly libc library Home Contacts Phone Browser Other optimized for embedded use Application Framework Surface Manager for composing Activity Window Content View window manager with off-screen Manager Manager Providers System buffering Package Telephony Resource Location Notiication Manager Manager Manager Manager Manager Libraries 2D and 3D graphics hardware Surface Media SQLite Android Runtime support or software simulation Manager Framework Core Libs OpenGL FreeType WebKit Delvik Media codecs offer support for SGL SSL libc VM major audio/video codecs Display Camera Linux Kernel Flash Binder Driver Driver SQLite database Driver Driver Keypad WiFi Audio Power Driver Driver Driver Mgmt WebKit library for fast HTML rendering
  • 7. Dalvik   Dalvik VM is Google’s implementation of Java Optimized for mobile devices Key Dalvik differences: Register-based versus stack-based VM Dalvik runs .dex files More efficient and compact implementation Different set of Java libraries than SDK
  • 8. Android  and  Java   Android Java = Java SE – AWT/Swing + Android API
  • 9. Applica6on  Framework   Activation manager controls the life Applications cycle of the app Home Contacts Phone Browser Other Content providers encapsulate data Application Framework that is shared (e.g. contacts) Activity Window Content View Manager Manager Providers System Package Telephony Resource Location Notiication Resource manager manages Manager Manager Manager Manager Manager everything that is not the code Libraries Surface Media SQLite Android Runtime Manager Framework Location manager figures out the Core Libs location of the phone (GPS, GSM, OpenGL FreeType WebKit Delvik WiFi) SGL SSL libc VM Notification manager for events Display Driver Camera Driver Linux Kernel Flash Driver Binder Driver such as arriving messages, Keypad WiFi Audio Driver Power Mgmt Driver Driver appointments, etc
  • 12. File  System   The file system has three main mount points. One for system, one for the apps, and one for whatever. Each app has its own sandbox easily accessible to it. No one else can access its data. The sandbox is in /data/data/com.marakana/ SDCard is expected to always be there. It’s a good place for large files, such as movies and music. Everyone can access it.
  • 13. Security   Each Android application Android Application runs inside its own Linux process. Linux Process Additionally, each application has its own sandbox file File system with its own set of Prefs DB System preferences and its own database. Other applications cannot access any of its data, unless it is explicitly shared.
  • 14. ANDROID     STARTUP  &     RUNTIME  
  • 17. Layer  Interac6ons   There are three main scenarios for your app to talk to native library: -  Directly -  Via native service -  Via native daemon It will depend on the type of app and type of native library which method works best.
  • 18. App  –  Run6me  Service  -­‐  Lib  
  • 19. App  –  Run6me-­‐Na6ve  Service-­‐Lib  
  • 21. Binder  IPC   High-performance IPC: shared memory, per-process thread pool, synchronous
  • 22. Java  Na6ve  Interface   JNI defines naming and coding convention so that Java VM can find and call native code. JNI is built into JVM to provide access to OS I/O and others.
  • 23. Building  and  Running  JNI  Code  
  • 25. What’s  in  NDK?   Tools to build and compile your native code for the device architecture (such as ARM) A way to package your library into the APK file so you can distribute your application easily A set of native system headers that will be supported for the future releases of Android platform (libc, libm, libz, liblog, JNI headers, some C++ headers, and OpenGL) (some) documentation, sample code and examples
  • 26. Why  NDK?   NDK allows you to develop parts of your Android application in C/C++. You cannot develop native-only apps in NDK – your app is still subject to security sandboxing. Main motivation for native code is performance.
  • 28. Summary   For most applications, you will just need Android SDK to develop apps. Sometimes you may need NDK to make parts of your app run faster. Ultimately, you can build your own Android platform from source. Marko Gargenta, Marakana.com marko@marakana.com +1-415-647-7000 Licensed under Creative Commons License (cc-by-nc-nd). Please Share!