Android Anatomy and Physiology

Similar documents
Overview of CS 282 & Android

Deep Inside Android. OpenExpo Zurich September 25 th, Gilles Printemps - Senior Architect. Copyright 2007 Esmertec AG.

Android Basics. Xin Yang

Programming the Android Platform. Logistics

An Introduction to Android Application Development. Serdar Akın, Haluk Tüfekçi

Android Operating System:

Lecture 1 Introduction to Android

An Introduction to Android

Overview. The Android operating system is like a cake consisting of various layers.

Android Architecture. Alexandra Harrison & Jake Saxton

Mobile Devices - An Introduction to the Android Operating Environment. Design, Architecture, and Performance Implications

Mobile Devices - An Introduction to the Android Operating Environment. Design, Architecture, and Performance Implications

Android on i.mx Applications Processors

OMX, Android, GStreamer How do I decide what to use? 15 July 2011

Research and Design of Universal and Open Software Development Platform for Digital Home

Creating and Using Databases for Android Applications

Example of Standard API

A Look through the Android Stack

A Short Introduction to Android

An Introduction to Android. Huang Xuguang Database Lab. Inha University

Android Application Development. Daniel Switkin Senior Software Engineer, Google Inc.

The Android Platform

Android Operating System

Android Virtualization from Sierraware. Simply Secure

Технологии Java. Android: Введение. Кузнецов Андрей Николаевич. Санкт-Петербургский Государственный Политехнический Университет

Performance Analysis of Android Platform

Reminders. Lab opens from today. Many students want to use the extra I/O pins on

ANDROID OPERATING SYSTEM

Running Android Applications on BlackBerry 10 developer.blackberry.com/android

Development. SriSeshaa Technologies. Table of Contents

GETTING STARTED WITH ANDROID DEVELOPMENT FOR EMBEDDED SYSTEMS

Introduction to Android

Using Chroot to Bring Linux Applications to Android

Mobile Operating Systems. Week I

Mobile Phones Operating Systems

ODROID Multithreading in Android

Graduate presentation for CSCI By Janakiram Vantipalli ( Janakiram.vantipalli@colorado.edu )

Android Architecture Diagram:

Mobility Introduction Android. Duration 16 Working days Start Date 1 st Oct 2013

Introduction to Android

Inside Android's UI Embedded Linux Conference Europe 2012 Karim

Android Programming and Security

Architecture (SOSP 2011) 11/11/2011 Minsung Jang

Android Architecture For Beginners

Lecture 17: Mobile Computing Platforms: Android. Mythili Vutukuru CS 653 Spring 2014 March 24, Monday

Software development. Development requirements. Java. Android SDK. Eclipse IDE (optional)

Application of Android OS as Real-time Control Platform**

ANDROID BASED MOBILE APPLICATION DEVELOPMENT and its SECURITY

Virtualization: Hypervisors for Embedded and Safe Systems. Hanspeter Vogel Triadem Solutions AG

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

BogDan Vatra and Andy Gryc. Qt on Android: Is it right for you?

Des Moines Area Community College

ANDROID PROGRAMMING - INTRODUCTION. Roberto Beraldi

Specialized Android APP Development Program with Java (SAADPJ) Duration 2 months

Università Degli Studi di Parma. Distributed Systems Group. Android Development. Lecture 1 Android SDK & Development Environment. Marco Picone

Here to take you beyond Mobile Application development using Android Course details

Introduction to Android

INTRODUCTION TO ANDROID CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 11 02/15/2011

INTERMEDIATE ANDROID DEVELOPMENT Course Syllabus

Issues in Android on Mobile Platform and Their Resolution

CS378 -Mobile Computing. Android Overview and Android Development Environment

TUTORIALS AND QUIZ ANDROID APPLICATION SANDEEP REDDY PAKKER. B. Tech in Aurora's Engineering College, 2013 A REPORT

Running a Program on an AVD

Mobile Operating Systems Lesson 05 Windows CE Part 1

How to Run Your Existing Android APK on the Tizen Platform. Chandra Bajpai Matt O Keefe OpenMobile World Wide

ANDROID. Programming basics

Development Techniques for Native/Hybrid Tizen Apps. Presented by Kirill Kruchinkin

An Android Multimedia Framework based on Gstreamer

What else can you do with Android? Inside Android. Chris Simmonds. Embedded Linux Conference Europe Copyright 2010, 2net Limited.

Android (Basic + Advance) Application Development

Android Security (and Not) Internals

Android 5.0: Lollipop OS

Android Development. Lecture AD 0 Android SDK & Development Environment. Università degli Studi di Parma. Mobile Application Development

A Survey on Android vs. Linux

Android builders summit The Android media framework

ECWM511 MOBILE APPLICATION DEVELOPMENT Lecture 1: Introduction to Android

AppScope: Application Energy Metering Framework for Android Smartphones using Kernel Activity Monitoring

STLinux Software development environment

Remote Desktop on Mobile

Multithreading and Java Native Interface (JNI)!

UNIVERSITY AUTHORISED EDUCATION PARTNER (WDP)

Developing Android Apps for BlackBerry 10. JAM854 Mike Zhou- Developer Evangelist, APAC Nov 30, 2012

Publishing to TIZEN Using the Automated Conversion/Repackaging of Existing Android Apps. Hyeokgon Ryu, Infraware Technology, Ltd.

Workshop on Android and Applications Development

Performance Optimization and Debug Tools for mobile games with PlayCanvas

Table of Contents. Adding Build Targets to the SDK 8 The Android Developer Tools (ADT) Plug-in for Eclipse 9

Introduction to Android

ANDROID INTRODUCTION TO ANDROID

Building an Android client. Rohit Nayak Talentica Software

CELLS A Virtual Mobile Smartphone Architecture

Praktikum Entwicklung Mediensysteme (für Master)

Praktikum Entwicklung von Mediensystemen (Android)

Transcription:

Android Anatomy and Physiology

Agenda Android Anatomy Linux Kernel Native Libraries Android Runtime Layer Interaction Application Framework Android Physiology Start-up Walkthrough

Android Anatomy Applications Home Dialer SMS/MMS IM Browser Camera Alarm Calculator Contacts Activity Voice Dial Email Window Calendar Media Player Albums Application Framework Content Providers View System Clock Notification Package Telephony Libraries Resource Location Android Runtime Surface Media Framework SQLite Core Libraries OpenGL ES FreeType WebKit Dalvik Virtual Machine SGL SSL Libc Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Agenda Android Anatomy Linux Kernel Native Libraries Android Runtime Layer Interaction Application Framework Android Physiology Start-up Walkthrough

Linux Kernel Android is built on the Linux kernel, but Android is not Linux No native windowing system No glibc support Does not include the full set of standard Linux utilities Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Linux Kernel Standard Linux 2.6.24 Kernel Patch of kernel enhancements to support Android Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Why Linux Kernel? Great memory and process management Permissions-based security model Proven driver model Support for shared libraries Itʼs already open source! Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Kernel Enhancements Alarm Ashmem Binder Power Management Low Memory Killer Kernel Debugger Logger Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Binder: Problem Applications and Services may run in separate processes but must communicate and share data IPC can introduce significant processing overhead and security holes Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Binder: Solution Driver to facilitate inter-process communication (IPC) High performance through shared memory Per-process thread pool for processing requests Reference counting, and mapping of object references across processes Synchronous calls between processes Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Binder in Action Process A Process B App A Service B

Binder in Action Process A Process B App A Context Service B

Binder in Action Process A Process B App A Context Service B get service

Binder in Action Process A Process B App A Context Binder Driver Service B get service service

Binder in Action Process A Process B App A Context Binder Driver Service B get service service

Binder in Action Process A Process B App A Context Binder Driver Service B get service service call foo(object)

Binder in Action Process A Process B App A Context Binder Driver Service B get service service call foo(object) marshal proxy object

Binder in Action Process A Process B App A Context Binder Driver Service B get service service call foo(object) marshal proxy object relay to IPC threads

Binder in Action Process A Process B App A Context Binder Driver Service B get service service call foo(object) marshal proxy object relay to IPC threads call return

Binder Android Interface Definition Language (AIDL) http://code.google.com/android/reference/aidl.html Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

PM Problem Mobile devices run on battery power Batteries have limited capacity Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

PM Solution Built on top of standard Linux Power Management (PM) More aggressive power management policy Components make requests to keep the power on through wake locks Supports different types of wake locks Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Android PM in Action App A Power PM Driver

Android PM in Action App A Power PM Driver new wake lock PARTIAL

Android PM in Action App A Power PM Driver new wake lock PARTIAL create wake lock

Android PM in Action App A Power PM Driver new wake lock PARTIAL create wake lock Turn off LCD

Android PM in Action App A Power PM Driver new wake lock PARTIAL create wake lock Turn off LCD release release

Android PM in Action App A Power PM Driver new wake lock PARTIAL create wake lock Turn off LCD release release Turn off CPU

Android PM android.os.power Use wake locks carefully! useractivity(long when, ); Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Kernel The Android kernel source is available today at: http://git.android.com Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Agenda Android Anatomy Linux Kernel Native Libraries Android Runtime Layer Interaction Application Framework Android Physiology Start-up Walkthrough

Android Anatomy Libraries Surface Media Framework SQLite OpenGL ES FreeType WebKit SGL SSL Libc Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Native Libraries Bionic Libc Function Libraries Native Servers Hardware Abstraction Libraries Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Native Libraries Bionic Libc Function Libraries Native Servers Hardware Abstraction Libraries Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

What is Bionic? What is bionic? Custom libc implementation, optimized for embedded use. Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Why Bionic? Why build a custom libc library? License: we want to keep GPL out of user-space Size: will load in each process, so it needs to be small Fast: limited CPU power means we need to be fast Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Bionic libc BSD License Small size and fast code paths Very fast and small custom pthread implementation Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Bionic libc Built-in support for important Android-specific services system properties getprop( my.system.property, buff, default); log capabilities LOGI( Logging a message with priority Info ); Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Bionic libc Doesn't support certain POSIX features Not compatible with Gnu Libc (glibc) All native code must be compiled against bionic Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Native Libraries Bionic Libc Function Libraries Native Servers Hardware Abstraction Libraries Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

WebKit Based on open source WebKit browser: http://webkit.org Renders pages in full (desktop) view Full CSS, Javascript, DOM, AJAX support Support for single-column and adaptive view rendering Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Media Framework Based on PacketVideo OpenCORE platform Supports standard video, audio, still-frame formats Support for hardware / software codec plug-ins Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

SQLite Light-weight transactional data store Back end for most platform data storage Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Native Libraries Bionic Libc Function Libraries Native Servers Hardware Abstraction Libraries Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Surface Flinger Surface App App Surface Surface Flinger Frame Buffer Surface Provides system-wide surface composer, handling all surface rendering to frame buffer device Can combine 2D and 3D surfaces and surfaces from multiple applications Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Surface Flinger Surfaces passed as buffers via Binder IPC calls Can use OpenGL ES and 2D hardware accelerator for its compositions Double-buffering using page-flip Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Audio Flinger App App Tone Audio Media Player Game Audio Audio Flinger Earpeace Speaker Bluetooth Manages all audio output devices Processes multiple audio streams into PCM audio out paths Handles audio routing to various outputs Libraries Surface Media Framework SQLite WebKit Libc OpenGL ES Audio FreeType SSL

Native Libraries Bionic Libc Function Libraries Native Servers Hardware Abstraction Libraries Libraries Surface Media Framework SQLite LibWebCore Libc OpenGL ES Audio FreeType SSL

Hardware Abstraction Layer Applications Home Dialer SMS/MMS IM Browser Camera Alarm Calculator Contacts Activity Voice Dial Email Window Calendar Media Player Photo Album Application Framework Content Providers View System Clock Notification Package Surface OpenGL ES Media Framework Audio Telephony Libraries Resource SQLite WebKit Libc FreeType SSL Linux Kernel Display Driver Camera Driver Bluetooth Driver Location Hardware Abstraction Layer Android Runtime Shared Memory Driver Core Libraries Dalvik Virtual Machine Graphics Audio Camera Bluetooth GPS Radio (RIL) WiFi Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Hardware Abstraction Libraries User space C/C++ library layer Defines the interface that Android requires hardware drivers to implement Separates the Android platform logic from the hardware interface Hardware Abstraction Layer Graphics Audio Camera Bluetooth GPS Radio (RIL) WiFi

Hardware Abstraction Libraries Why do we need a user-space HAL? Not all components have standardized kernel driver interfaces Kernel drivers are GPL which exposes any proprietary IP Android has specific requirements for hardware drivers Hardware Abstraction Layer Graphics Audio Camera Bluetooth GPS Radio (RIL) WiFi

HAL Header Example // must be provided by each Acme hardware implementation typedef struct { int (*foo)( void ); char (*bar)( void ); } AcmeFunctions; const AcmeFunctions *Acme_Init(const struct Env *env, int argc, char **argv); Hardware Abstraction Layer Graphics Audio Camera Bluetooth GPS Radio (RIL) WiFi

Hardware Abstraction Libraries Libraries are loaded dynamically at runtime as needed dlhandle = dlopen( /system/lib/libacme.so, RTLD_NOW);... acmeinit = (const AcmeFunctions *(*)(const struct Env *, int, char **))dlsym(dlhandle, Acme_Init");... acmefuncs = acmeinit(&env, argc, argv); Hardware Abstraction Layer Graphics Audio Camera Bluetooth GPS Radio (RIL) WiFi

Agenda Android Anatomy Linux Kernel Native Libraries Android Runtime Layer Interaction Application Framework Android Physiology Start-up Walkthrough

Android Anatomy Libraries Android Runtime Surface Media Framework SQLite Core Libraries OpenGL ES FreeType WebKit Dalvik Virtual Machine SGL SSL Libc Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Dalvik Virtual Machine Androidʼs custom clean-room implementation virtual machine Provides application portability and runtime consistency Runs optimized file format (.dex) and Dalvik bytecode Java.class /.jar files converted to.dex at build time Android Runtime Core Libraries Dalvik Virtual Machine

Dalvik Virtual Machine Designed for embedded environment Uses runtime memory very efficiently Supports multiple virtual machine processes per device Highly CPU-optimized bytecode interpreter Android Runtime Core Libraries Dalvik Virtual Machine

Core Libraries Core APIs for Java language provide a powerful, yet simple and familiar development platform Data structures Utilities File access Graphics Network Access Android Runtime Core Libraries Dalvik Virtual Machine

Agenda Android Anatomy Linux Kernel Native Libraries Android Runtime Application Framework Android Physiology Start-up Walkthrough Layer Interaction

Android Anatomy Activity Window Application Framework Content Providers View System Notification Package Telephony Libraries Resource Location Android Runtime Surface Media Framework SQLite Core Libraries OpenGL ES FreeType WebKit Dalvik Virtual Machine SGL SSL Libc Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Core Platform Services Services that are essential to the Android platform Behind the scenes - applications typically donʼt access them directly Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Core Platform Services Activity Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Core Platform Services Activity Package Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Core Platform Services Activity Package Window Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Core Platform Services Activity Package Window Resource Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Core Platform Services Activity Package Window Resource Content Providers Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Core Platform Services Activity View System Package Window Resource Content Providers Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Provide access to lower-level hardware APIs Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Provide access to lower-level hardware APIs Typically accessed through local object Location lm = (Location) Context.getSystemService(Context.LOCATION_SERVICE); Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Telephony Service Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Telephony Service Location Service Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Telephony Service Location Service Bluetooth Service Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Telephony Service Location Service Bluetooth Service WiFi Service Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Telephony Service Location Service Bluetooth Service WiFi Service USB Service Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Hardware Services Telephony Service Location Service Bluetooth Service WiFi Service USB Service Sensor Service Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Application Framework More Information At Google I/O Online Inside the Android Application Framework http://code.google.com/android Activity Window Application Framework Content Providers View System Notification Package Telephony Resource Location

Android Anatomy Applications Home Dialer SMS/MMS IM Browser Camera Alarm Calculator Contacts Activity Voice Dial Email Window Calendar Media Player Albums Application Framework Content Providers View System Clock Notification Package Telephony Libraries Resource Location Android Runtime Surface Media Framework SQLite Core Libraries OpenGL ES FreeType WebKit Dalvik Virtual Machine SGL SSL Libc Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

Agenda Android Anatomy Linux Kernel Native Libraries Layer Interaction Application Framework Android Physiology Start-up Walkthrough

Agenda Android Anatomy Linux Kernel Native Libraries Layer Interaction Application Framework Android Physiology Start-up Walkthrough

Runtime Walkthrough It all starts with init Similar to most Linux-based systems at startup, the bootloader loads the Linux kernel and starts the init process. Init Linux Kernel

Runtime Walkthrough Init starts Linux daemons, including: USB Daemon (usbd) to manage USB connections Android Debug Bridge (adbd) to manage ADB connections Debugger Daemon (debuggerd) to manage debug processes requests (dump memory, etc.) Radio Interface Layer Daemon (rild) to manage communication with the radio usbd adbd debuggerd rild Init

Runtime Walkthrough Init process starts the zygote process: A nascent process which initializes a Dalvik VM instance Loads classes and listens on socket for requests to spawn VMs Forks on request to create VM instances for managed processes Copy-on-write to maximize re-use and minimize footprint usbd debuggerd adbd daemons Zygote Init

Runtime Walkthrough Init starts runtime process: Initializes Service the context manager for Binder that handles service registration and lookup Registers Service as default context manager for Binder services Service usbd debuggerd adbd daemons runtime Zygote Init

Runtime Walkthrough Runtime process sends request for Zygote to start System Service Service usbd debuggerd adbd daemons runtime Zygote Init

Runtime Walkthrough Runtime process sends request for Zygote to start System Server Zygote forks a new VM instance for the System Service process and starts the service Service System Server usbd debuggerd adbd daemons runtime Zygote Dalvik VM Init

Runtime Walkthrough System Service starts the native system servers, including: Surface Flinger Audio Flinger Audio Flinger Surface Flinger Service System Server usbd debuggerd adbd daemons runtime Zygote Dalvik VM Init

Runtime Walkthrough Native system servers register with Service as IPC service targets: Audio Flinger Surface Flinger Service System Server usbd debuggerd adbd daemons runtime Zygote Dalvik VM Init

Runtime Walkthrough System Service starts the Android managed services: Content Window Telephony Service Activity Bluetooth Service Package Connectivity Service Power Location Camera Surface Service Flinger Service System Server usbd debuggerd adbd daemons runtime Zygote Dalvik VM Init

Runtime Walkthrough Android managed Services register with Service : Content Window Telephony Service Activity Bluetooth Service Package Connectivity Service Power Location Service Camera Service Camera Surface Service Flinger Service System Server usbd debuggerd adbd daemons runtime Zygote Dalvik VM Init

Runtime Walkthrough Power Activity Camera Surface Service Flinger Service System Server usbd debuggerd adbd daemons runtime Zygote Dalvik VM Init

Runtime Walkthrough After system server loads all services, the system is ready Init Daemon Processes runtime Zygote System Server Activity Package Window Dalvik VM Init usbd debuggerd adbd daemons runtime Zygote Surface Flinger Audio Flinger

Runtime Walkthrough After system server loads all services, the system is ready Init Daemon Processes runtime Zygote System Server Home Activity Package Window Home Dalvik VM Dalvik VM Init usbd debuggerd adbd daemons runtime Zygote Surface Flinger Audio Flinger

Runtime Walkthrough After system server loads all services, the system is ready Init Daemon Processes runtime Zygote System Server Home Activity Package Window Home Dalvik VM Dalvik VM Init usbd debuggerd adbd daemons runtime Zygote Surface Flinger Audio Flinger libc libc libc libc libc libc

Runtime Walkthrough Each subsequent application is launched in itʼs own process Daemon Processes runtime Zygote System Server Home Contacts Activity Package Window Home Dalvik VM Contacts Dalvik VM Dalvik VM usbd debuggerd adbd daemons runtime Zygote Surface Flinger Audio Flinger libc libc libc libc libc libc

Agenda Android Anatomy Linux Kernel Native Libraries Layer Interaction Framework Services Android Physiology Start-up Walkthrough

Layer Interaction There are 3 main flavors of Android layer cake: App Runtime Service lib App Runtime Service Native Service lib App Runtime Service Native Daemon lib

Layer Interaction There are 3 main flavors of Android layer cake: App Runtime Service lib App Runtime Service Native Service lib App Runtime Service Native Daemon lib

Android Runtime Services Applications Application Application Framework Binder IPC Runtime Service Libraries Linux Kernel Kernel Driver

Android Runtime Services Applications Application Application Framework Binder IPC Runtime Service Libraries JNI Native Service Binding Linux Kernel Kernel Driver

Android Runtime Services Applications Application Application Framework Binder IPC Runtime Service Libraries JNI Native Service Binding Dynamic load HAL Library Linux Kernel Kernel Driver

Android Runtime Services Applications Application Application Framework Binder IPC Runtime Service Libraries JNI Native Service Binding Dynamic load HAL Library Linux Kernel Kernel Driver

Example: Location Applications Application Binder IPC Application Framework Location Service GpsLocationProvider Libraries JNI GpsLocationProvider libgps.so Dynamic load Linux Kernel Kernel Driver

Layer Interaction There are 3 main flavors of Android layer cake: App Runtime Service lib App Runtime Service Native Service lib App Runtime Service Native Daemon lib

Android Native Services Applications Application Application Framework Libraries Runtime Service JNI Native Service Binding Linux Kernel

Android Native Services Applications Application Application Framework Runtime Service Libraries JNI Native Service Binding Binder IPC Native Service Linux Kernel

Android Native Services Applications Application Application Framework Runtime Service Libraries JNI Native Service Binding Binder IPC Native Service Dynamic load HAL Library Linux Kernel

Android Native Services Applications Application Application Framework Runtime Service Libraries JNI Native Service Binding Binder IPC Native Service Dynamic load HAL Library Linux Kernel Kernel Driver

Android Native Services Applications Application Application Framework MediaPlayer Libraries JNI MediaPlayer Binder IPC AudioFlinger Dynamic load Media Framework libaudio.so Linux Kernel Kernel Driver

Android Native Services Applications Application Application Framework MediaPlayer Libraries JNI MediaPlayer Binder IPC AudioFlinger Dynamic load Media Framework libaudio.so ALSA Linux Kernel Kernel Driver

Android Native Services Applications Application Application Framework MediaPlayer Libraries JNI MediaPlayer Binder IPC AudioFlinger Dynamic load Media Framework libaudio.so Proprietary Audio Driver Linux Kernel

Layer Interaction There are 3 main flavors of Android layer cake: App Runtime Service lib App Runtime Service Native Service lib App Runtime Service Native Daemon lib

Daemon Connection Applications Application Application Framework Libraries Runtime Service JNI Native Service Binding Linux Kernel Kernel Driver

Daemon Connection Applications Application Application Framework Runtime Service Libraries JNI Native Service Binding sockets Daemon Linux Kernel Kernel Driver

Daemon Connection Applications Application Application Framework Runtime Service Libraries JNI Native Service Binding sockets Daemon Dynamic load HAL Library Linux Kernel Kernel Driver

Daemon Connection Applications Application Application Framework Telephony Libraries JNI Telephony sockets rild Dynamic load libril.so Linux Kernel Kernel Driver

Layer Interaction There are 3 main flavors of Android layer cake: App Runtime Service lib App Runtime Service Native Service lib App Runtime Service Native Daemon lib

Android Anatomy Applications Home Dialer SMS/MMS IM Browser Camera Alarm Calculator Contacts Activity Voice Dial Email Window Calendar Media Player Albums Application Framework Content Providers View System Clock Notification Package Telephony Libraries Resource Location Android Runtime Surface Media Framework SQLite Core Libraries OpenGL ES FreeType WebKit Dalvik Virtual Machine SGL SSL Libc Linux Kernel Display Driver Camera Driver Bluetooth Driver Shared Memory Driver Binder (IPC) Driver USB Driver Keypad Driver WiFi Driver Audio Drivers Power Management

The End code.google.com

Questions Q&A