SlideShare a Scribd company logo
Android Internals
Course Objectives
 Develop embedded systems with Google Android

 Customize and install Google Android for your target platform




Android Internals @ SAS               2               08/23/12
Course Prerequisites
 C/C++

 Basic Java

 Basic Unix/Linux command line interface experience
       An extra 1 day training may be needed.


 Embedded systems development is a plus.




Android Internals @ SAS                   3            08/23/12
Course Notes
 Ask any time.

 Set your cell to silent.

 Course assumes Linux is already ported to your hardware.
       An extra 5 days training may be needed.




Android Internals @ SAS                   4          08/23/12
Outline
Lectures                                     Labs
    Introduction to Android                  Android Source Code
    Android Source Code & Compilation        1st Compilation
    Linux Kernel Introduction                Compile and Boot an Android Kernel
    Changes Introduced in the Android
     Kernel
    Android Booting Scenarios                Supporting a New Board
    Developing and Debugging with ADB        Use ADB
    Android Filesystem Layout
    Android Build System                     System Customization
    Android Native Layer                     Building a Library
                                              Adding a Native Application to the
                                               Build

Android Internals @ SAS                  5                   08/23/12
How does Embedded Linux System
Boot?
 We will talk about bootloader and Init process only.




Android Internals @ SAS               6                  08/23/12
What does a Bootloader do?
    Basic HW initialization
    Loading of an application binary, usually an operating system kernel
    Decompression of the application binary
    Execution of the application
    Most bootloaders provide a shell with various commands implementing
     different operations.
          Loading data
          Memory inspection
          HW diagnostics
          Testing
          ...




Android Internals @ SAS                7               08/23/12
PC Boatloaders
                                      BIOS executes from on board
                                       ROM.
                                          Basic HW initialization + 1st
                    BIOS                   bootloader loading
                                      1st stage bootloader loads a full
          1st stage bootloader         boatloader.
                                      Full bootloader with full
                                       functionality and features.
             Full boatloader
                                          It can load a kernel from a
                                           filesystem.
                   Kernel             Examples:
                                          GRUB
                                          Syslinux


Android Internals @ SAS          8                    08/23/12
Booting on Embedded CPUs – NOR
Flash
                               CPU starts executing code at a
                                fixed address when powered up.

                               HW design ensures that a NOR
                                flash is at this address.
                                   It can hold the 1st stage
                                    bootloader or even a full
                                    bootloader.


                               NOR flashes are very expensive
                                and limited in size.

                               Not very common nowdays

Android Internals @ SAS   9                   08/23/12
Booting on Embedded CPUs – !NOR
Flash
                                      ROM code is stored in an internal
                                       ROM in the CPU.

                ROM code
                                      ROM code loads bootstrap
                                       bootloader from non-volatile
         Bootstrap bootloader          storage into SRAM.


             Full boatloader          Bootstrap loads full bootloader
                                       into DRAM which in return loads
                                       the kernel in the DRAM.
                   Kernel




Android Internals @ SAS         10                  08/23/12
Examples of Embedded Bootloaders
 U-Boot
       http://www.denx.de/wiki/U-Boot

 Barebox
       http://www.barebox.org

 Redboot

 Yaboot

 PMON

 ...


Android Internals @ SAS                  11   08/23/12
Android Bootloader
 The bootloader is outside the realm of Android itself.

 The first-stage bootloader will provide support for:
       Loading recovery images to the system flash
       Putting the device into a mode where the developer can perform
        development tasks
              AKA fastboot mode
       These features should be disabled in production.


 In addition, it supports normal booting sequence.




Android Internals @ SAS                    12               08/23/12
What is Fastboot?
 A protocol to communicate bootloaders over USB.

 It is synchronous and driven by the host.

 Accessible with the fastboot command.

 Allows to:
          Transmit data
          Flash the various partitions of the device
          Get variables from the bootloader
          Control the boot sequence




Android Internals @ SAS                        13       08/23/12
Fastboot Usage
1.    Make sure that ADB or SDK installed on host.
2.    Install fastboot for your host.
3.    Turn off the device.
4.    Boot device into bootloader.
5.    Make sure the device is in FASTBOOT and not HBOOT.
6.    Connect the device to the computer via USB.
7.    On your computer, open terminal and run fastboot command.




Android Internals @ SAS              14              08/23/12
Fastboot Command
 Usage: fastboot [ <option> ] <command>
Command                               Description
update <filename>                     Reflash device from filename
flashall                              Flash boot + recovery + system
flash <partition> [ <filename> ]      Write a file to a flash Partion
erase <partition>                     Erase a flash partition
getvar <variable>                     Display a bootloader variable
boot <kernel> [ <ramdisk> ]           Download and boot kernel
flash:raw boot <kernel> [ <ramdisk> ] Create bootimage and flash it
devices                               List all connected devices
continue                              Continue with autoboot
reboot                                Reboot device normally
reboot-bootloader                     Reboot device into bootloader
Android Internals @ SAS                   15                    08/23/12
Fastboot Command cont’d

Option                    Description
-w                        Erase userdata and cache
-s <serial number>        Specify device serial number
-p <product>              Specify product name
-c <cmdline>              Override kernel commandline
-i <vendor id>            Specify a custom USB vendor id
-b <base_addr>            Specify a custom kernel base address
-n <page size>            Specify the nand page size. default:2048




Android Internals @ SAS                        16                    08/23/12
Fastboot Session Example




Android Internals @ SAS   17   08/23/12
Init Starts Daemons
 Including
          usbd
          adbd
          debuggerd
          rild
          ...




                          Daemon
                           Daemon
                            Daemon

                                      Init


Android Internals @ SAS          18          08/23/12
Init Starts Zygote Process
 A Zygote process:
          Initializes a Dalvik VM instance
          Loads classes
          Listens for requests to spawn VMs
          Forks on requests VMs using copy-on-write to minimize footprint




                                   Daemon
                                    Daemon                          Zygote
                                     Daemon

                                                     Init

Android Internals @ SAS                      19                 08/23/12
Init Starts Runtime Process
    A runtime process:
          Initializes a service manager and
           registers it as a default context
           manager for Binder services




                                                    Service
                                                    Manager

                                   Daemon
                                    Daemon          Runtime        Zygote
                                     Daemon

                                                      Init

Android Internals @ SAS                        20             08/23/12
Runtime Requests to Start the System
Server Process
 Requested from Zygote
 Zygote forks a new VM for the system server process and starts the
  server.



                                                           System
                                                           Server

                                           Service          Dalvik
                                           Manager           VM

                           Daemon
                            Daemon         Runtime         Zygote
                             Daemon

                                             Init

Android Internals @ SAS               21              08/23/12
System Server Starts the Native
System Servers
 Including:
       Surface flinger
       Audio flinger
       ...                                Daemon
                                            Daemon
                                             Flingers

                                                             System
 Native system servers register                             Server
  with service manager as IPC
                                           Service            Dalvik
  service targets.
                                           Manager             VM

                           Daemon
                            Daemon         Runtime           Zygote
                            Daemons

                                             Init

Android Internals @ SAS               22                08/23/12
System Server Starts the Android
Managed Services
 Including
          Content manager
          Window manager
          Telephony service                   Daemon
                                                Daemon                     Daemon
                                                                            Daemon
                                                 Flingers                   Managers
          Activity manager
          …
                                                                 System
                                                                 Server

                                               Service            Dalvik
                                               Manager             VM

                               Daemon
                                Daemon         Runtime           Zygote
                                 Daemon

                                                 Init

Android Internals @ SAS                   23                08/23/12
Android Managed Services Register
with the Service Manager


                                          Daemon
                                           Daemon                     Daemon
                                                                       Daemon
                                            Flingers                   Managers

                                                            System
                                                            Server

                                          Service            Dalvik
                                          Manager             VM

                          Daemon
                           Daemon         Runtime           Zygote
                            Daemon

                                            Init

Android Internals @ SAS              24                08/23/12
Android Startup Overview

                          System Startup




Android Internals @ SAS         25         08/23/12
Android Startup Overview – Home
Window




                          libc




Android Internals @ SAS          26   08/23/12
Android Startup Overview – Any
Application




                          libc




Android Internals @ SAS          27   08/23/12
How do Layers Interact?
 There are 3 main scenarios for the app to talk to the native libraries.
       Directly
       Through a service
       Through a daemon


 Depends on:
                                                       Applications
       Application
       Native library implementation              Application Framework
       Android version                                  Libraries

                                                       Linux Kernel




Android Internals @ SAS                 28                08/23/12
Direct Layers Interaction
       Applications




                          Application

                                                      Binder IPC
       Application
       Framework




                                          Runtime Service


                                                     JNI




                                        Native Service Binding
       Libraries




                                                       Dynamic Loading

                                              HAL Library
       Linux Kernel




                                              Device Driver


Android Internals @ SAS                  29                              08/23/12
Direct Layers Interaction – Location
ManagerApplications




                          Application

                                                       Binder IPC
       Application
       Framework




                                         Location Manager Service



                                           GPS Location Provider

                                                       JNI

                                        GPS Location Provider Binder
       Libraries




                                                        Dynamic Loading

                                                 libgps.so
       Linux Kernel




                                             GPS Device Driver


Android Internals @ SAS                     30                            08/23/12
Through a Service Layers Interaction
       Applications




                      Application

                                                 Binder IPC
       Application
       Framework




                                      Runtime Service


                                                JNI



                                                              Binder IPC
                                    Native Service Binding                     Native Service
       Libraries




                                                                                        Dynamic Loading

                                                                                HAL Library
       Linux Kernel




                                                                               Device Driver



Android Internals @ SAS                               31                   08/23/12
Through a Service Layers Interaction –
Media Player
       Applications




                      Application

                                               Binder IPC
       Application
       Framework




                                       Media Player


                                              JNI



                                                            Binder IPC
                                    Media Player Binder                       Audio Flinger
       Libraries




                                                                                         Dynamic Loading
                                    Media Framework
                                                                               libaudio.so
       Linux Kernel




                                                                                  ALSA



                                                                          Speakers Device Driver

Android Internals @ SAS                             32                   08/23/12
Through a Daemon Layers Interaction
       Applications




                      Application

                                                 Binder IPC
       Application
       Framework




                                      Runtime Service


                                                JNI



                                                              Sockets
                                    Native Service Binding                  Native Daemon
       Libraries




                                                                                     Dynamic Loading

                                                                             HAL Library
       Linux Kernel




                                                                            Device Driver



Android Internals @ SAS                               33                08/23/12
Android Internals @ SAS   34   08/23/12

More Related Content

PDF
Android Treble: Blessing or Trouble?
PPTX
Android Booting Sequence
PDF
Init of Android
PPT
Learning AOSP - Android Booting Process
PDF
Embedded Android : System Development - Part I
PDF
Android Things : Building Embedded Devices
PDF
Embedded Android : System Development - Part II (HAL)
PDF
Booting Android: bootloaders, fastboot and boot images
Android Treble: Blessing or Trouble?
Android Booting Sequence
Init of Android
Learning AOSP - Android Booting Process
Embedded Android : System Development - Part I
Android Things : Building Embedded Devices
Embedded Android : System Development - Part II (HAL)
Booting Android: bootloaders, fastboot and boot images

What's hot (20)

PDF
Embedded Android Workshop with Pie
PDF
Android's HIDL: Treble in the HAL
PPTX
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
PDF
Understanding the Android System Server
PPT
Android booting sequece and setup and debugging
PDF
Low Level View of Android System Architecture
PDF
Introduction to Android Window System
PDF
Android Boot Time Optimization
PPTX
Overview of Android binder IPC implementation
PPT
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
PDF
Design and Concepts of Android Graphics
PDF
Jagan Teki - U-boot from scratch
ODP
Inter-process communication of Android
PPTX
Binder: Android IPC
PDF
Android Binder IPC for Linux
PDF
Android Storage - Vold
PPT
Learning AOSP - Android Linux Device Driver
ODP
Embedded Android : System Development - Part III
PDF
Project meeting: Android Graphics Architecture Overview
PPTX
Android bootup process
Embedded Android Workshop with Pie
Android's HIDL: Treble in the HAL
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Understanding the Android System Server
Android booting sequece and setup and debugging
Low Level View of Android System Architecture
Introduction to Android Window System
Android Boot Time Optimization
Overview of Android binder IPC implementation
"Learning AOSP" - Android Hardware Abstraction Layer (HAL)
Design and Concepts of Android Graphics
Jagan Teki - U-boot from scratch
Inter-process communication of Android
Binder: Android IPC
Android Binder IPC for Linux
Android Storage - Vold
Learning AOSP - Android Linux Device Driver
Embedded Android : System Development - Part III
Project meeting: Android Graphics Architecture Overview
Android bootup process
Ad

Similar to Android Booting Scenarios (20)

PDF
Android Internals
PDF
TOMOYO Linux on Android
PDF
Android for Embedded Linux Developers
PDF
Mobile operating systems
PDF
Android Internals
PDF
Introduction to Modern U-Boot
PDF
Building
PDF
Android on Intel Architecture: ROM Cooking Tutorial
PDF
Android is NOT just 'Java on Linux'
PDF
It's Assembler, Jim, but not as we know it: (ab)using binaries from embedded ...
PDF
Linux Porting to a Custom Board
PDF
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
PDF
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
PDF
Android Internals at Linaro Connect Asia 2013
ODP
Android crash debugging
PPTX
TMS320DM8148 Embedded Linux
PDF
Android ROM cooking: A practical Tutorial (DroidCon Torino 2014)
PDF
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
ODP
5. boot process
PPTX
Taking Control of Your Mobile Device - Rooting-n-Roms
Android Internals
TOMOYO Linux on Android
Android for Embedded Linux Developers
Mobile operating systems
Android Internals
Introduction to Modern U-Boot
Building
Android on Intel Architecture: ROM Cooking Tutorial
Android is NOT just 'Java on Linux'
It's Assembler, Jim, but not as we know it: (ab)using binaries from embedded ...
Linux Porting to a Custom Board
A War Story: Porting Android 4.0 to a Custom Board (ELCE 2012)
Bringing up Android on your favorite X86 Workstation or VM (AnDevCon Boston, ...
Android Internals at Linaro Connect Asia 2013
Android crash debugging
TMS320DM8148 Embedded Linux
Android ROM cooking: A practical Tutorial (DroidCon Torino 2014)
Native Android Userspace part of the Embedded Android Workshop at Linaro Conn...
5. boot process
Taking Control of Your Mobile Device - Rooting-n-Roms
Ad

More from Amr Ali (ISTQB CTAL Full, CSM, ITIL Foundation) (20)

PDF
Introduction to state machines in Embedded Software Design
PDF
Embedded linux network device driver development
PDF
Introduction to Embedded Systems a Practical Approach
PPTX
ISTQB Advanced Test Manager Training 2012 - Testing Process
PDF
Introduction to Software Test Automation
PPTX
ISTQB Foundation Agile Tester 2014 Training, Agile SW Development
PPTX
ISTQB Technical Test Analyst 2012 Training - Structure-Based Testing
PPTX
ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...
PPTX
PPT
Introduction to embedded systems
PPT
PPT
PPTX
PPT
FreeRTOS Course - Semaphore/Mutex Management
Introduction to state machines in Embedded Software Design
Embedded linux network device driver development
Introduction to Embedded Systems a Practical Approach
ISTQB Advanced Test Manager Training 2012 - Testing Process
Introduction to Software Test Automation
ISTQB Foundation Agile Tester 2014 Training, Agile SW Development
ISTQB Technical Test Analyst 2012 Training - Structure-Based Testing
ISTQB Technical Test Analyst 2012 Training - The Technical Test Analyst's Tas...
Introduction to embedded systems
FreeRTOS Course - Semaphore/Mutex Management

Recently uploaded (20)

PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
A Presentation on Artificial Intelligence
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Electronic commerce courselecture one. Pdf
PDF
KodekX | Application Modernization Development
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPT
Teaching material agriculture food technology
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
PDF
Approach and Philosophy of On baking technology
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Agricultural_Statistics_at_a_Glance_2022_0.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
A Presentation on Artificial Intelligence
Dropbox Q2 2025 Financial Results & Investor Presentation
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Electronic commerce courselecture one. Pdf
KodekX | Application Modernization Development
Chapter 3 Spatial Domain Image Processing.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
Teaching material agriculture food technology
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
Approach and Philosophy of On baking technology
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Understanding_Digital_Forensics_Presentation.pptx

Android Booting Scenarios

  • 2. Course Objectives  Develop embedded systems with Google Android  Customize and install Google Android for your target platform Android Internals @ SAS 2 08/23/12
  • 3. Course Prerequisites  C/C++  Basic Java  Basic Unix/Linux command line interface experience  An extra 1 day training may be needed.  Embedded systems development is a plus. Android Internals @ SAS 3 08/23/12
  • 4. Course Notes  Ask any time.  Set your cell to silent.  Course assumes Linux is already ported to your hardware.  An extra 5 days training may be needed. Android Internals @ SAS 4 08/23/12
  • 5. Outline Lectures Labs  Introduction to Android  Android Source Code  Android Source Code & Compilation  1st Compilation  Linux Kernel Introduction  Compile and Boot an Android Kernel  Changes Introduced in the Android Kernel  Android Booting Scenarios  Supporting a New Board  Developing and Debugging with ADB  Use ADB  Android Filesystem Layout  Android Build System  System Customization  Android Native Layer  Building a Library  Adding a Native Application to the Build Android Internals @ SAS 5 08/23/12
  • 6. How does Embedded Linux System Boot?  We will talk about bootloader and Init process only. Android Internals @ SAS 6 08/23/12
  • 7. What does a Bootloader do?  Basic HW initialization  Loading of an application binary, usually an operating system kernel  Decompression of the application binary  Execution of the application  Most bootloaders provide a shell with various commands implementing different operations.  Loading data  Memory inspection  HW diagnostics  Testing  ... Android Internals @ SAS 7 08/23/12
  • 8. PC Boatloaders  BIOS executes from on board ROM.  Basic HW initialization + 1st BIOS bootloader loading  1st stage bootloader loads a full 1st stage bootloader boatloader.  Full bootloader with full functionality and features. Full boatloader  It can load a kernel from a filesystem. Kernel  Examples:  GRUB  Syslinux Android Internals @ SAS 8 08/23/12
  • 9. Booting on Embedded CPUs – NOR Flash  CPU starts executing code at a fixed address when powered up.  HW design ensures that a NOR flash is at this address.  It can hold the 1st stage bootloader or even a full bootloader.  NOR flashes are very expensive and limited in size.  Not very common nowdays Android Internals @ SAS 9 08/23/12
  • 10. Booting on Embedded CPUs – !NOR Flash  ROM code is stored in an internal ROM in the CPU. ROM code  ROM code loads bootstrap bootloader from non-volatile Bootstrap bootloader storage into SRAM. Full boatloader  Bootstrap loads full bootloader into DRAM which in return loads the kernel in the DRAM. Kernel Android Internals @ SAS 10 08/23/12
  • 11. Examples of Embedded Bootloaders  U-Boot  http://www.denx.de/wiki/U-Boot  Barebox  http://www.barebox.org  Redboot  Yaboot  PMON  ... Android Internals @ SAS 11 08/23/12
  • 12. Android Bootloader  The bootloader is outside the realm of Android itself.  The first-stage bootloader will provide support for:  Loading recovery images to the system flash  Putting the device into a mode where the developer can perform development tasks  AKA fastboot mode  These features should be disabled in production.  In addition, it supports normal booting sequence. Android Internals @ SAS 12 08/23/12
  • 13. What is Fastboot?  A protocol to communicate bootloaders over USB.  It is synchronous and driven by the host.  Accessible with the fastboot command.  Allows to:  Transmit data  Flash the various partitions of the device  Get variables from the bootloader  Control the boot sequence Android Internals @ SAS 13 08/23/12
  • 14. Fastboot Usage 1. Make sure that ADB or SDK installed on host. 2. Install fastboot for your host. 3. Turn off the device. 4. Boot device into bootloader. 5. Make sure the device is in FASTBOOT and not HBOOT. 6. Connect the device to the computer via USB. 7. On your computer, open terminal and run fastboot command. Android Internals @ SAS 14 08/23/12
  • 15. Fastboot Command  Usage: fastboot [ <option> ] <command> Command Description update <filename> Reflash device from filename flashall Flash boot + recovery + system flash <partition> [ <filename> ] Write a file to a flash Partion erase <partition> Erase a flash partition getvar <variable> Display a bootloader variable boot <kernel> [ <ramdisk> ] Download and boot kernel flash:raw boot <kernel> [ <ramdisk> ] Create bootimage and flash it devices List all connected devices continue Continue with autoboot reboot Reboot device normally reboot-bootloader Reboot device into bootloader Android Internals @ SAS 15 08/23/12
  • 16. Fastboot Command cont’d Option Description -w Erase userdata and cache -s <serial number> Specify device serial number -p <product> Specify product name -c <cmdline> Override kernel commandline -i <vendor id> Specify a custom USB vendor id -b <base_addr> Specify a custom kernel base address -n <page size> Specify the nand page size. default:2048 Android Internals @ SAS 16 08/23/12
  • 17. Fastboot Session Example Android Internals @ SAS 17 08/23/12
  • 18. Init Starts Daemons  Including  usbd  adbd  debuggerd  rild  ... Daemon Daemon Daemon Init Android Internals @ SAS 18 08/23/12
  • 19. Init Starts Zygote Process  A Zygote process:  Initializes a Dalvik VM instance  Loads classes  Listens for requests to spawn VMs  Forks on requests VMs using copy-on-write to minimize footprint Daemon Daemon Zygote Daemon Init Android Internals @ SAS 19 08/23/12
  • 20. Init Starts Runtime Process  A runtime process:  Initializes a service manager and registers it as a default context manager for Binder services Service Manager Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 20 08/23/12
  • 21. Runtime Requests to Start the System Server Process  Requested from Zygote  Zygote forks a new VM for the system server process and starts the server. System Server Service Dalvik Manager VM Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 21 08/23/12
  • 22. System Server Starts the Native System Servers  Including:  Surface flinger  Audio flinger  ... Daemon Daemon Flingers System  Native system servers register Server with service manager as IPC Service Dalvik service targets. Manager VM Daemon Daemon Runtime Zygote Daemons Init Android Internals @ SAS 22 08/23/12
  • 23. System Server Starts the Android Managed Services  Including  Content manager  Window manager  Telephony service Daemon Daemon Daemon Daemon Flingers Managers  Activity manager  … System Server Service Dalvik Manager VM Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 23 08/23/12
  • 24. Android Managed Services Register with the Service Manager Daemon Daemon Daemon Daemon Flingers Managers System Server Service Dalvik Manager VM Daemon Daemon Runtime Zygote Daemon Init Android Internals @ SAS 24 08/23/12
  • 25. Android Startup Overview System Startup Android Internals @ SAS 25 08/23/12
  • 26. Android Startup Overview – Home Window libc Android Internals @ SAS 26 08/23/12
  • 27. Android Startup Overview – Any Application libc Android Internals @ SAS 27 08/23/12
  • 28. How do Layers Interact?  There are 3 main scenarios for the app to talk to the native libraries.  Directly  Through a service  Through a daemon  Depends on: Applications  Application  Native library implementation Application Framework  Android version Libraries Linux Kernel Android Internals @ SAS 28 08/23/12
  • 29. Direct Layers Interaction Applications Application Binder IPC Application Framework Runtime Service JNI Native Service Binding Libraries Dynamic Loading HAL Library Linux Kernel Device Driver Android Internals @ SAS 29 08/23/12
  • 30. Direct Layers Interaction – Location ManagerApplications Application Binder IPC Application Framework Location Manager Service GPS Location Provider JNI GPS Location Provider Binder Libraries Dynamic Loading libgps.so Linux Kernel GPS Device Driver Android Internals @ SAS 30 08/23/12
  • 31. Through a Service Layers Interaction Applications Application Binder IPC Application Framework Runtime Service JNI Binder IPC Native Service Binding Native Service Libraries Dynamic Loading HAL Library Linux Kernel Device Driver Android Internals @ SAS 31 08/23/12
  • 32. Through a Service Layers Interaction – Media Player Applications Application Binder IPC Application Framework Media Player JNI Binder IPC Media Player Binder Audio Flinger Libraries Dynamic Loading Media Framework libaudio.so Linux Kernel ALSA Speakers Device Driver Android Internals @ SAS 32 08/23/12
  • 33. Through a Daemon Layers Interaction Applications Application Binder IPC Application Framework Runtime Service JNI Sockets Native Service Binding Native Daemon Libraries Dynamic Loading HAL Library Linux Kernel Device Driver Android Internals @ SAS 33 08/23/12
  • 34. Android Internals @ SAS 34 08/23/12

Editor's Notes

  • #19: 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
  • #22: System server is the java framework corresponding to the native service manager.
  • #23: A flinger is like a user space driver that combines different inputs from different applications and send them to the HW device.