SlideShare a Scribd company logo
1 of 56
Android Internals
RAJESH KHETAN
Co-founder @ Bangalore Tech Events
Agenda
 Android Boot Up Process
 How Package Manager Service works ?
A Typical Android Boot-Up
KERNEL
Installd,
adbd,
servicemanger...
System Server
Zygote
App 1 , App 2 …App N
INIT
A Typical Android Boot-Up
KERNEL
Installd,
adbd,
servicemanger...
System Server
Zygote
App 1 , App 2 …App N
INIT
Kernel
 Special forked version of Linux
 Features :
 Wake locks
 Low Memory Killer (OOM adjustment)
 Provides Binder driver
A Typical Android Boot-Up
KERNEL
Installd,
adbd,
servicemanger...
System Server
Zygote
App 1 , App 2 …App N
INIT
INIT
 Root / First User Space process
 Responsibilities :
 Set up file system permissions
 Start native daemons
A Typical Android Boot-Up
KERNEL
Installd,
adbd,
servicemanger...
System Server
Zygote
App 1 , App 2 …App N
INIT
A Typical Android Boot-Up
KERNEL
Installd,
adbd,
servicemanger...
System Server
Zygote
App 1 , App 2 …App N
INIT
Zygote
 Base of all other java processes
 The app_process command invokes Android Runtime to start the first DVM/ART
 The VM then invokes zygotes main method (ZygoteInit.java)
Zygote
Register Zygote Socket
fork systemserver
Preloads Classes And Resources
Wait for requests
fork()
Zygote
Register Zygote Socket
fork systemserver
Preloads Classes And Resources
Wait for requests
fork()
Zygote
Register Zygote Socket
fork systemserver
Preloads Classes And Resources
Wait for requests
fork()
Zygote
Register Zygote Socket
fork systemserver
Preloads Classes And Resources
Wait for requests
fork()
Zygote
Register Zygote Socket
fork systemserver
Preloads Classes And Resources
Wait for requests
fork()
A Typical Android Boot-Up
KERNEL
Installd,
adbd,
servicemanger...
System Server
Zygote
App 1 , App 2 …App N
INIT
A Typical Android Boot-Up
KERNEL
Installd,
adbd,
servicemanger...
System Server
Zygote
App 1 , App 2 …App N
INIT
System Server
 Heart of the Android System
 Start system services
 Register services with the service manager
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
System Server
Creates system context
Start bootstrap services
Start Other Services
Start core services
ActivityManagerService
PackageManagerService
WindowManagerService
Wifi/Bluetooth Service
SystemUI
Loads server library
Package Manager Service
 Responsibilties :
 Installation/Uninstallation of apps
 Managing Permissions & Certificate Handling
 Exposing APIs to 3rd party applications
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service(Flow)
Scan Packages
Grant Permissions
Initialization
Manifest Parsing
Perform DexOpt
Collect Certificates
Generate Package Info
Asset Loading
Package Manager Service
 Package information is cached into /data/system/packages.xml
 Runtime permissions are cached into /data/system/0/runtime_packages.xml
PackageIntsaller
Offers the ability to install, upgrade, and
remove applications on the device.
PackageInstallerActivity
 Launched when a new application is installed via side loading
 Display parsing errors via a dialog.
 Enable unknown applications setting.
 Memory check
 Check for same existing package
 Install app
Installd
 PMS lacks root privileges
 Creating , deleting & changing the ownership of applications directories requires superuser capabilities .
 The PMS delegates these operations to the installd daemon
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel Init
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel
- Initialization
- Mount root FS
- Starts Init Process
Init
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel
Init
- Set up env variables
- Mount FS
- Set UP FS perm
- Start native daemons
A Quick Recap
Native Daemons
- servicemanager
- app_process -X Zygote
- adbd
- installd
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel Init
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
- Start first VM
- Call zygote’s main method
Kernel Init
A Quick Recap
Native Daemons
Zygote
- Register Zygote socket
- Preload classes & res.
- Start systemserver process
- Listen for connections
Launcher
System Server
Activity Manager
Android Runtime
Kernel Init
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
- Start services
- Register with service manager
Activity Manager
Android Runtime
Kernel Init
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
- Init itself
- Send Intent.Category_HOME
- Send BOOT_COMPLETE
Android Runtime
Kernel Init
A Quick Recap
Native Daemons
Zygote
Launcher
- Init itself
- Register OnClick handlers
System Server
Activity Manager
Android Runtime
Kernel Init
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel Init
Click
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel Init
Click
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel Init
Click
A Quick Recap
Native Daemons
Zygote
Launcher
System Server
Activity Manager
Android Runtime
Kernel Init
Click
A Quick Recap
Native Daemons
- servicemanager
- app_process -X Zygote
- adbd
- installd
Zygote
- Register Zygote socket
- Preload classes & resources
- Start systemserver process
- Listen for connections
Launcher
- Init itself
- Register OnClick handlers
Click
System Server
- Start services
- Register with servicemanager
Activity Manager
- Init itself
- Send Intent.Category_HOME
- Send BOOT_COMPLETE
broadcast
New app
Android Runtime
- Start first VM
- Call zygote’s main method
Kernel
- Initialization
- Mount root FS
- Starts Init Process
Init
- Set up env variables
- Mount FS
- Set UP FS perm
- Start native daemons
THANK YOU
 References :
 Embedded Android – Karim Yaghmour
 https://android.googlesource.com/
www.bangaloretechevents.com
rajeshkhetan.rk@gmail.com
Contact :

More Related Content

What's hot

Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveBin Chen
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)Siji Sunny
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux DevelopersOpersys inc.
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsLinaro
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debuggingUtkarsh Mankad
 
Android+init+process
Android+init+processAndroid+init+process
Android+init+processHong Jae Kwon
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debuggingAshish Agrawal
 

What's hot (20)

Explore Android Internals
Explore Android InternalsExplore Android Internals
Explore Android Internals
 
Binder: Android IPC
Binder: Android IPCBinder: Android IPC
Binder: Android IPC
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Hacking Android OS
Hacking Android OSHacking Android OS
Hacking Android OS
 
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspectiveAndroid graphic system (SurfaceFlinger) : Design Pattern's perspective
Android graphic system (SurfaceFlinger) : Design Pattern's perspective
 
Android Things : Building Embedded Devices
Android Things : Building Embedded DevicesAndroid Things : Building Embedded Devices
Android Things : Building Embedded Devices
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
Applied Computer Science Concepts in Android
Applied Computer Science Concepts in AndroidApplied Computer Science Concepts in Android
Applied Computer Science Concepts in Android
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)A deep dive into Android OpenSource Project(AOSP)
A deep dive into Android OpenSource Project(AOSP)
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
How to Customize Android Framework&System
How to Customize Android Framework&SystemHow to Customize Android Framework&System
How to Customize Android Framework&System
 
Android for Embedded Linux Developers
Android for Embedded Linux DevelopersAndroid for Embedded Linux Developers
Android for Embedded Linux Developers
 
Android Binder: Deep Dive
Android Binder: Deep DiveAndroid Binder: Deep Dive
Android Binder: Deep Dive
 
Porting Android
Porting AndroidPorting Android
Porting Android
 
Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Android+init+process
Android+init+processAndroid+init+process
Android+init+process
 
Android crash debugging
Android crash debuggingAndroid crash debugging
Android crash debugging
 
Aidl service
Aidl serviceAidl service
Aidl service
 

Similar to Android internals By Rajesh Khetan

Install VMWare Tools CentOS 7
Install VMWare Tools CentOS 7Install VMWare Tools CentOS 7
Install VMWare Tools CentOS 7VCP Muthukrishna
 
Interview questions
Interview questionsInterview questions
Interview questionsxavier john
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersHaitham Refaat
 
Word press, the automated way
Word press, the automated wayWord press, the automated way
Word press, the automated wayMichaël Perrin
 
Front end workflow with yeoman
Front end workflow with yeomanFront end workflow with yeoman
Front end workflow with yeomanhassan hafez
 
OpenStack Murano introduction
OpenStack Murano introductionOpenStack Murano introduction
OpenStack Murano introductionVictor Zhang
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Controlelliando dias
 
CLUG 2010 09 - systemd - the new init system
CLUG 2010 09 - systemd - the new init systemCLUG 2010 09 - systemd - the new init system
CLUG 2010 09 - systemd - the new init systemPaulWay
 
Systemd for administrators
Systemd for administratorsSystemd for administrators
Systemd for administratorsSusant Sahani
 
Systemd for administrators
Systemd for administratorsSystemd for administrators
Systemd for administratorsSusant Sahani
 
Rock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment WorkflowsRock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment WorkflowsAOE
 
Timings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical HackerTimings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical HackerStacy Devino
 
3 App Compat Win7
3 App Compat Win73 App Compat Win7
3 App Compat Win7llangit
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy Systemadrian_nye
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011pundiramit
 
Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Agora Group
 
Getting Started With CFEngine - Updated Version
Getting Started With CFEngine - Updated VersionGetting Started With CFEngine - Updated Version
Getting Started With CFEngine - Updated VersionCFEngine
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsRaul Leite
 

Similar to Android internals By Rajesh Khetan (20)

Installation
InstallationInstallation
Installation
 
Install VMWare Tools CentOS 7
Install VMWare Tools CentOS 7Install VMWare Tools CentOS 7
Install VMWare Tools CentOS 7
 
Interview questions
Interview questionsInterview questions
Interview questions
 
Protractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine ReportersProtractor Testing Automation Tool Framework / Jasmine Reporters
Protractor Testing Automation Tool Framework / Jasmine Reporters
 
Word press, the automated way
Word press, the automated wayWord press, the automated way
Word press, the automated way
 
Front end workflow with yeoman
Front end workflow with yeomanFront end workflow with yeoman
Front end workflow with yeoman
 
OpenStack Murano introduction
OpenStack Murano introductionOpenStack Murano introduction
OpenStack Murano introduction
 
Continuous Integration using Cruise Control
Continuous Integration using Cruise ControlContinuous Integration using Cruise Control
Continuous Integration using Cruise Control
 
CLUG 2010 09 - systemd - the new init system
CLUG 2010 09 - systemd - the new init systemCLUG 2010 09 - systemd - the new init system
CLUG 2010 09 - systemd - the new init system
 
Systemd for administrators
Systemd for administratorsSystemd for administrators
Systemd for administrators
 
Systemd for administrators
Systemd for administratorsSystemd for administrators
Systemd for administrators
 
Linux Presentation
Linux PresentationLinux Presentation
Linux Presentation
 
Rock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment WorkflowsRock-solid Magento Development and Deployment Workflows
Rock-solid Magento Development and Deployment Workflows
 
Timings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical HackerTimings of Init : Android Ramdisks for the Practical Hacker
Timings of Init : Android Ramdisks for the Practical Hacker
 
3 App Compat Win7
3 App Compat Win73 App Compat Win7
3 App Compat Win7
 
A Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy SystemA Fabric/Puppet Build/Deploy System
A Fabric/Puppet Build/Deploy System
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012Android. behind the scenes_programatica 2012
Android. behind the scenes_programatica 2012
 
Getting Started With CFEngine - Updated Version
Getting Started With CFEngine - Updated VersionGetting Started With CFEngine - Updated Version
Getting Started With CFEngine - Updated Version
 
Automação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOpsAutomação do físico ao NetSecDevOps
Automação do físico ao NetSecDevOps
 

Android internals By Rajesh Khetan

  • 2. Agenda  Android Boot Up Process  How Package Manager Service works ?
  • 3. A Typical Android Boot-Up KERNEL Installd, adbd, servicemanger... System Server Zygote App 1 , App 2 …App N INIT
  • 4. A Typical Android Boot-Up KERNEL Installd, adbd, servicemanger... System Server Zygote App 1 , App 2 …App N INIT
  • 5. Kernel  Special forked version of Linux  Features :  Wake locks  Low Memory Killer (OOM adjustment)  Provides Binder driver
  • 6. A Typical Android Boot-Up KERNEL Installd, adbd, servicemanger... System Server Zygote App 1 , App 2 …App N INIT
  • 7. INIT  Root / First User Space process  Responsibilities :  Set up file system permissions  Start native daemons
  • 8. A Typical Android Boot-Up KERNEL Installd, adbd, servicemanger... System Server Zygote App 1 , App 2 …App N INIT
  • 9. A Typical Android Boot-Up KERNEL Installd, adbd, servicemanger... System Server Zygote App 1 , App 2 …App N INIT
  • 10. Zygote  Base of all other java processes  The app_process command invokes Android Runtime to start the first DVM/ART  The VM then invokes zygotes main method (ZygoteInit.java)
  • 11. Zygote Register Zygote Socket fork systemserver Preloads Classes And Resources Wait for requests fork()
  • 12. Zygote Register Zygote Socket fork systemserver Preloads Classes And Resources Wait for requests fork()
  • 13. Zygote Register Zygote Socket fork systemserver Preloads Classes And Resources Wait for requests fork()
  • 14. Zygote Register Zygote Socket fork systemserver Preloads Classes And Resources Wait for requests fork()
  • 15. Zygote Register Zygote Socket fork systemserver Preloads Classes And Resources Wait for requests fork()
  • 16. A Typical Android Boot-Up KERNEL Installd, adbd, servicemanger... System Server Zygote App 1 , App 2 …App N INIT
  • 17. A Typical Android Boot-Up KERNEL Installd, adbd, servicemanger... System Server Zygote App 1 , App 2 …App N INIT
  • 18. System Server  Heart of the Android System  Start system services  Register services with the service manager
  • 19. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 20. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 21. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 22. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 23. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 24. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 25. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 26. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 27. System Server Creates system context Start bootstrap services Start Other Services Start core services ActivityManagerService PackageManagerService WindowManagerService Wifi/Bluetooth Service SystemUI Loads server library
  • 28. Package Manager Service  Responsibilties :  Installation/Uninstallation of apps  Managing Permissions & Certificate Handling  Exposing APIs to 3rd party applications
  • 29. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 30. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 31. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 32. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 33. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 34. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 35. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 36. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 37. Package Manager Service(Flow) Scan Packages Grant Permissions Initialization Manifest Parsing Perform DexOpt Collect Certificates Generate Package Info Asset Loading
  • 38. Package Manager Service  Package information is cached into /data/system/packages.xml  Runtime permissions are cached into /data/system/0/runtime_packages.xml
  • 39. PackageIntsaller Offers the ability to install, upgrade, and remove applications on the device.
  • 40. PackageInstallerActivity  Launched when a new application is installed via side loading  Display parsing errors via a dialog.  Enable unknown applications setting.  Memory check  Check for same existing package  Install app
  • 41. Installd  PMS lacks root privileges  Creating , deleting & changing the ownership of applications directories requires superuser capabilities .  The PMS delegates these operations to the installd daemon
  • 42. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime Kernel Init
  • 43. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime Kernel - Initialization - Mount root FS - Starts Init Process Init
  • 44. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime Kernel Init - Set up env variables - Mount FS - Set UP FS perm - Start native daemons
  • 45. A Quick Recap Native Daemons - servicemanager - app_process -X Zygote - adbd - installd Zygote Launcher System Server Activity Manager Android Runtime Kernel Init
  • 46. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime - Start first VM - Call zygote’s main method Kernel Init
  • 47. A Quick Recap Native Daemons Zygote - Register Zygote socket - Preload classes & res. - Start systemserver process - Listen for connections Launcher System Server Activity Manager Android Runtime Kernel Init
  • 48. A Quick Recap Native Daemons Zygote Launcher System Server - Start services - Register with service manager Activity Manager Android Runtime Kernel Init
  • 49. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager - Init itself - Send Intent.Category_HOME - Send BOOT_COMPLETE Android Runtime Kernel Init
  • 50. A Quick Recap Native Daemons Zygote Launcher - Init itself - Register OnClick handlers System Server Activity Manager Android Runtime Kernel Init
  • 51. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime Kernel Init Click
  • 52. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime Kernel Init Click
  • 53. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime Kernel Init Click
  • 54. A Quick Recap Native Daemons Zygote Launcher System Server Activity Manager Android Runtime Kernel Init Click
  • 55. A Quick Recap Native Daemons - servicemanager - app_process -X Zygote - adbd - installd Zygote - Register Zygote socket - Preload classes & resources - Start systemserver process - Listen for connections Launcher - Init itself - Register OnClick handlers Click System Server - Start services - Register with servicemanager Activity Manager - Init itself - Send Intent.Category_HOME - Send BOOT_COMPLETE broadcast New app Android Runtime - Start first VM - Call zygote’s main method Kernel - Initialization - Mount root FS - Starts Init Process Init - Set up env variables - Mount FS - Set UP FS perm - Start native daemons
  • 56. THANK YOU  References :  Embedded Android – Karim Yaghmour  https://android.googlesource.com/ www.bangaloretechevents.com rajeshkhetan.rk@gmail.com Contact :