SlideShare a Scribd company logo
Android. Behind The Scenes
              R
              a
              d
              u
              M
              O
               I
              S
              A
              N
              A
Agenda

     Android Short Intro
     Use-case: QEmu
     Android Init System
     Application Launch




2
Android Short Intro
     Home                        Contacts                  Phone                           Browser                ...
Applications
                      Telephon         Resourc                               Notificatio
    Activity                                             Location
                          y               e                                       n
    Manager                                              Manager
                                                                             Manager
                      Manager          Manager

            Package          Window           Content                View
            Manager          Manager         Providers              System
                                                                                                     Android Runtime
Android Framework
                                                                                                      Core Libraries
                                           Media
     Surface Manager                                                   SQLite
                                        Framework                                                     Dalvik Virtual
                                                                                                        Machine
      Open GL | ES                      Free Type                     Webkit

             SGL                            SSL                         libc

Libraries
                                                                                                                Linux Kernel
       Display                          Camera                        Flash Memory                      Binder(IPC)
        Driver                           Driver                           Driver                           Driver

       Keypad                            WiFi                            Audio                            Power
        Driver                          Driver                          Drivers                         Management




3
Use-case: QEmu

    So what exactly is QEmu?
    QEMU is a processor emulator which has two different
    operating modes:
     full system emulation, which emulates a full system including
    the corresponding hard disk image
     user mode emulation, which allows you to run a simple
    cross-compiled executable




4
Use-case: QEmu
    mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
    echo ":ARM:M:18:(::/data/qemu-arm:" > /proc/sys/fs/binfmt_misc/register

    mount -t binfmt_misc none /proc/sys/fs/binfmt_misc
    echo ":CLR:M::MZ::/usr/bin/mono:" > /proc/sys/fs/binfmt_misc/register

              Name is the name of the binary format
                                           The magic number
                                                                            program that is to be run with the
                                                                            matching file as an argument

        :name:type:offset:magic:mask:interpreter:
                                                      What part of magic number is significant

                                   Where to look for the magic number

                          E or M




5
Use-case: QEmu
           Why?
     Sandbox binary applications
     Debugging/tracing binary applications
     Run Android Apps with native arm binary on x86
    Platforms

          How?
    Two approaches:
    Intercept the Fork starting the Application Process
    Run a second emulated Zygote




6
Android Init System
     bootl
     oader




    Linux
    kernel



      init




          init.rc
    Init.<machine>.rc




7
Android Init file
    service ril-daemon /system/bin/rild
      socket rild stream 660 root radio
      socket rild-debug stream 660 radio system
      user root
      group radio cache inet misc audio sdcard_rw net_admin net_raw qcom_oncrpc diag


    service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server
       socket zygote stream 660 root system
       onrestart write /sys/android_power/request_state wake
       onrestart write /sys/power/state on
       onrestart restart media
       onrestart restart netd


    service media /system/bin/mediaserver
       user media
       group system audio camera graphics inet net_bt net_bt_admin net_raw
       ioprio rt 4




8
Android Init System
                                                            Power
     bootl                                                 Manager
     oader                                                 Telephon
                                                               y         App
                                                           Registry
                                                Core        Activity
                                               Services                  App
                     Native                                Manager
                                instantiate
    Linux           Daemons    AppRuntime                  Window
    kernel                                                 Manager       App

                                                             ...
                               system_serv
      init          Zygote          er
                                                             Mount
                                                             Service
                                                           Connectivit
                     Other                                      y
                                              Additional    Service
                    processe     Select                     Location
                                               Services
                        s        Loop                       Manager
                                 Mode                         Audio
                                                             Service
          init.rc
    Init.<machine>.rc                                          ...




9
Application Launch

     Laun                                                                                 Application                  onCreate()

     cher                                                                                  Classes

                                                                                                    load
                                                                                                    into
                                                                                                    ram


                                          Activity        bindApplication()                 Activity
     launch activity by intent




                                                                                                           callActivityOnCreate()
                                                                                            Thread                                  Instrumentati
                                          Manager         thread.attach()                    Dalvik                                       on
                                          Service
                                                                                              VM




                                                                              forkAndSpecialize()
                                                              Zygote




                                                     zygote
                                 Binder              socket




10
Application Launch
     Laun
     cher




                                          Activity
     launch activity by intent




                                          Manager
                                          Service


                                                      zygote               forkAndSpecialize()
                                                                 Zygote
                                                      socket


                                                     zygote_e
                                                      zygote    Zygote_e   forkAndSpecialize()
                                                        mu       Zygote
                                                      socket      mu
                                                      socket
                                 Binder




11
12

More Related Content

PPT
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)
PDF
Extreme Late Binding
PDF
Marakana Android Internals
PPTX
Profiling Multicore Systems to Maximize Core Utilization
PDF
Android Optimization: Myth and Reality
PPTX
Dalvik Vm &amp; Jit
PDF
Introduction to Android by Demian Neidetcher
PDF
Android Internals
Learning, Analyzing and Protecting Android with TOMOYO Linux (JLS2009)
Extreme Late Binding
Marakana Android Internals
Profiling Multicore Systems to Maximize Core Utilization
Android Optimization: Myth and Reality
Dalvik Vm &amp; Jit
Introduction to Android by Demian Neidetcher
Android Internals

What's hot (11)

PDF
TOMOYO Linux on Android
PDF
Learn C Programming Language by Using GDB
PDF
Android for Java Developers
PDF
Android Deep Dive
PPT
Android For Java Developers
PDF
V Labs Product Presentation
PDF
Develop Community-based Android Distribution and Upstreaming Experience
PDF
Android: A 9,000-foot Overview
PDF
Discover System Facilities inside Your Android Phone
PDF
An FPGA-based Scalable Simulation Accelerator for Tile Architectures @HEART2011
TOMOYO Linux on Android
Learn C Programming Language by Using GDB
Android for Java Developers
Android Deep Dive
Android For Java Developers
V Labs Product Presentation
Develop Community-based Android Distribution and Upstreaming Experience
Android: A 9,000-foot Overview
Discover System Facilities inside Your Android Phone
An FPGA-based Scalable Simulation Accelerator for Tile Architectures @HEART2011
Ad

Similar to Android. behind the scenes_programatica 2012 (20)

PDF
Google Io Introduction To Android
PDF
An Introduction To Android
PDF
Open Android
PDF
Mee go是您的新机遇
PDF
Deep Dive Into Android Security
PDF
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
PDF
Android for Java Developers at OSCON 2010
PPTX
Android and Intel Inside
PDF
Android For Managers Slides
PPTX
Deep Dive into WinRT
PDF
Android Internals
PDF
Understanding the Android System Server
PDF
Xtopia2010 wp7
PDF
Venus-c: Using open source clouds in eScience
 
PDF
MeeGo AppLab Desktop Summit 2011 - Submission and Validation
PDF
Android Services Black Magic by Aleksandar Gargenta
PDF
ANODE – Continuous Deployment with Node.js over Azure, Yosef Dinerstein
PDF
What’s New ?Linux on System z
PPTX
Introduction to Windows 8 Development
PPT
Nos Windows
Google Io Introduction To Android
An Introduction To Android
Open Android
Mee go是您的新机遇
Deep Dive Into Android Security
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Android for Java Developers at OSCON 2010
Android and Intel Inside
Android For Managers Slides
Deep Dive into WinRT
Android Internals
Understanding the Android System Server
Xtopia2010 wp7
Venus-c: Using open source clouds in eScience
 
MeeGo AppLab Desktop Summit 2011 - Submission and Validation
Android Services Black Magic by Aleksandar Gargenta
ANODE – Continuous Deployment with Node.js over Azure, Yosef Dinerstein
What’s New ?Linux on System z
Introduction to Windows 8 Development
Nos Windows
Ad

More from Agora Group (20)

PDF
How to Digitally Transform and Stay Competitive with a Zero-code Digital Busi...
PDF
Microservicii reutilizabile in arhitecturi bazate pe procese
PDF
The role of BPM in Paradigms Shift
PDF
Prezentare Ensight_BPM-20171004
PDF
Curs OSINT
PDF
Curs Digital Forensics
PDF
The next generation of Companies management: state of the art in BPM
PDF
Speed Dialing the Enterprise
PDF
ABPMP Romania
PDF
Arhitectura proceselor în Sistemul Informațional de Sănătate
PDF
IBM’s Smarter Process Reinvent Business
PDF
eHealth 2014_Radu Dop
PDF
Importanța registrelor pentru pacienți
PDF
CYBERCRIME AND THE HEALTHCARE INDUSTRY: Sistemul de sănătate, noua țintă a at...
PDF
Perspective naționale și internaționale ale informaticii și standardelor medi...
PDF
UTI_Dosarul electronic de sanatate
PPTX
Class IT - Enemy inside the wire
PPTX
Infologica - auditarea aplicatiilor mobile
PPTX
Agora Securitate yugo neumorni
PPT
Security threats in the LAN
How to Digitally Transform and Stay Competitive with a Zero-code Digital Busi...
Microservicii reutilizabile in arhitecturi bazate pe procese
The role of BPM in Paradigms Shift
Prezentare Ensight_BPM-20171004
Curs OSINT
Curs Digital Forensics
The next generation of Companies management: state of the art in BPM
Speed Dialing the Enterprise
ABPMP Romania
Arhitectura proceselor în Sistemul Informațional de Sănătate
IBM’s Smarter Process Reinvent Business
eHealth 2014_Radu Dop
Importanța registrelor pentru pacienți
CYBERCRIME AND THE HEALTHCARE INDUSTRY: Sistemul de sănătate, noua țintă a at...
Perspective naționale și internaționale ale informaticii și standardelor medi...
UTI_Dosarul electronic de sanatate
Class IT - Enemy inside the wire
Infologica - auditarea aplicatiilor mobile
Agora Securitate yugo neumorni
Security threats in the LAN

Recently uploaded (20)

PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Empathic Computing: Creating Shared Understanding
DOCX
The AUB Centre for AI in Media Proposal.docx
PPTX
MYSQL Presentation for SQL database connectivity
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PPTX
A Presentation on Artificial Intelligence
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
PPT
Teaching material agriculture food technology
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PDF
cuic standard and advanced reporting.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Digital-Transformation-Roadmap-for-Companies.pptx
Empathic Computing: Creating Shared Understanding
The AUB Centre for AI in Media Proposal.docx
MYSQL Presentation for SQL database connectivity
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
A Presentation on Artificial Intelligence
Dropbox Q2 2025 Financial Results & Investor Presentation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
Chapter 3 Spatial Domain Image Processing.pdf
Bridging biosciences and deep learning for revolutionary discoveries: a compr...
Teaching material agriculture food technology
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
cuic standard and advanced reporting.pdf
Encapsulation theory and applications.pdf
Encapsulation_ Review paper, used for researhc scholars
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Android. behind the scenes_programatica 2012

  • 1. Android. Behind The Scenes R a d u M O I S A N A
  • 2. Agenda Android Short Intro Use-case: QEmu Android Init System Application Launch 2
  • 3. Android Short Intro Home Contacts Phone Browser ... Applications Telephon Resourc Notificatio Activity Location y e n Manager Manager Manager Manager Manager Package Window Content View Manager Manager Providers System Android Runtime Android Framework Core Libraries Media Surface Manager SQLite Framework Dalvik Virtual Machine Open GL | ES Free Type Webkit SGL SSL libc Libraries Linux Kernel Display Camera Flash Memory Binder(IPC) Driver Driver Driver Driver Keypad WiFi Audio Power Driver Driver Drivers Management 3
  • 4. Use-case: QEmu So what exactly is QEmu? QEMU is a processor emulator which has two different operating modes: full system emulation, which emulates a full system including the corresponding hard disk image user mode emulation, which allows you to run a simple cross-compiled executable 4
  • 5. Use-case: QEmu mount -t binfmt_misc none /proc/sys/fs/binfmt_misc echo ":ARM:M:18:(::/data/qemu-arm:" > /proc/sys/fs/binfmt_misc/register mount -t binfmt_misc none /proc/sys/fs/binfmt_misc echo ":CLR:M::MZ::/usr/bin/mono:" > /proc/sys/fs/binfmt_misc/register Name is the name of the binary format The magic number program that is to be run with the matching file as an argument :name:type:offset:magic:mask:interpreter: What part of magic number is significant Where to look for the magic number E or M 5
  • 6. Use-case: QEmu Why? Sandbox binary applications Debugging/tracing binary applications Run Android Apps with native arm binary on x86 Platforms How? Two approaches: Intercept the Fork starting the Application Process Run a second emulated Zygote 6
  • 7. Android Init System bootl oader Linux kernel init init.rc Init.<machine>.rc 7
  • 8. Android Init file service ril-daemon /system/bin/rild socket rild stream 660 root radio socket rild-debug stream 660 radio system user root group radio cache inet misc audio sdcard_rw net_admin net_raw qcom_oncrpc diag service zygote /system/bin/app_process -Xzygote /system/bin --zygote --start-system-server socket zygote stream 660 root system onrestart write /sys/android_power/request_state wake onrestart write /sys/power/state on onrestart restart media onrestart restart netd service media /system/bin/mediaserver user media group system audio camera graphics inet net_bt net_bt_admin net_raw ioprio rt 4 8
  • 9. Android Init System Power bootl Manager oader Telephon y App Registry Core Activity Services App Native Manager instantiate Linux Daemons AppRuntime Window kernel Manager App ... system_serv init Zygote er Mount Service Connectivit Other y Additional Service processe Select Location Services s Loop Manager Mode Audio Service init.rc Init.<machine>.rc ... 9
  • 10. Application Launch Laun Application onCreate() cher Classes load into ram Activity bindApplication() Activity launch activity by intent callActivityOnCreate() Thread Instrumentati Manager thread.attach() Dalvik on Service VM forkAndSpecialize() Zygote zygote Binder socket 10
  • 11. Application Launch Laun cher Activity launch activity by intent Manager Service zygote forkAndSpecialize() Zygote socket zygote_e zygote Zygote_e forkAndSpecialize() mu Zygote socket mu socket Binder 11
  • 12. 12