Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Android, A premiere

Android, A premiere

Gave this talk at Jyothi Nivas College at Bangalore, India. It was to just get the students introduced to the world of Android

Shrayas Rajagopal

July 26, 2011
Tweet

More Decks by Shrayas Rajagopal

Other Decks in Technology

Transcript

  1. To err is human and to blame it on a computer is even more so.
    -­  Robert  Orben  

    View full-size slide

  2. Shrayas  
    Research  Engineer  
    1  1  1  1  0  0  0  0  1  1  1  1                                                                                                                                0  1  0  1  0  1  0  1  0  1  0  1  1  1  0  0  1    

    View full-size slide

  3. Shrayas  
    Research  Engineer  
    1  1  1  1  0  0  0  0  1  1  1  1                                                                                                                                0  1  0  1  0  1  0  1  0  1  0  1  1  1  0  0  1    

    View full-size slide

  4. Q  
    ?  
    ?  
    ?  
    ?  
    ?  
    ?  

    View full-size slide

  5. Q  
    ?  
    ?  
    ?  
    ?  
    ?  
    ?  

    View full-size slide

  6. WE ARE GOINGZ TO HATEZ U

    View full-size slide

  7. ANDROID
    WE ARE GOINGZ TO LOU U

    View full-size slide

  8. Agenda  
      What is Android
      History
      Layers
      Native Applications

    View full-size slide

  9. WHAT?
    Is  that  green  cute  thing?  

    View full-size slide

  10. Yes   No  
    OS  Opera9ng  
    System  

    View full-size slide

  11. Yes  
    OS  Opera9ng  
    System  
    “Yes  ,  android  IS  an  OS”  

    View full-size slide

  12. No  
    OS  Opera9ng  
    System  
    “No  No,  its  something  else”  

    View full-size slide

  13. No   “Android  isn’t  an  opera

    View full-size slide

  14. Software Stack

    View full-size slide

  15. {
    Software Stack
    linux based kernel

    View full-size slide

  16. Middleware
    Key applications
    Operating System
    {
    Software Stack
    linux based kernel

    View full-size slide

  17. Middleware
    Key applications
    Operating System
    {
    Software Stack
    linux based kernel

    View full-size slide

  18. Android “Android  isn’t  just  an  operaIts  something  more.”  

    View full-size slide

  19. Open Source
    developer
    developer
    developer
    developer
    tester
    tester

    View full-size slide

  20. developer?
    Android

    View full-size slide

  21. http://developer.android.com/sdk/index.html

    View full-size slide

  22. SDK
    •  Java
    •  Brains :)

    View full-size slide

  23. SDK
    •  Java
    •  Brains :)
    http://developer.android.com/guide/basics/what-is-android.html

    View full-size slide

  24. HISTORY .. WHOSE? MY STORY?

    View full-size slide

  25. 2003 2005
    October    
    @Palo  Alto,  California  

    View full-size slide

  26. 2003 2005
    October    
    @Palo  Alto,  California  
    Android, Inc. Was founded

    View full-size slide

  27. 2003 2005
    October    
    @Palo  Alto,  California  
    Android, Inc. Was founded

    View full-size slide

  28. 2003 2005
    October    
    @Palo  Alto,  California  
    Android, Inc. Was founded

    View full-size slide

  29. 2003 2005
    October    
    @Palo  Alto,  California  
    Android, Inc. Was founded

    View full-size slide

  30. 2003 2005
    October    
    @Palo  Alto,  California  
    Android, Inc. Was founded
    CHRIS
    WHITE

    View full-size slide

  31. 2003 2005
    October    
    @Palo  Alto,  California  
    Android, Inc. Was founded
    “..smarter mobile devices that are more aware
    of its owner's location and preferences."
    CHRIS
    WHITE

    View full-size slide

  32. 2005
    2003 August  

    View full-size slide

  33. 2005
    2003 August  
    Google acquires Android, Inc.

    View full-size slide

  34. 2005
    2003 August  
    Google acquires Android, Inc.
    CW

    View full-size slide

  35. 2005
    2003 August  
    Google acquires Android, Inc.
    CW
    “..Google was planning to enter the mobile
    phone market with this move.

    View full-size slide

  36. Late 2007
    2006 -­‐  Early  2007  

    View full-size slide

  37. Late 2007
    2006 -­‐  Early  2007  
    Focus was purely
    development.

    View full-size slide

  38. Late 2007
    2006 -­‐  Early  2007  
    Focus was purely
    development.
    Based on the linux kernel

    View full-size slide

  39. Late 2007
    2006 -­‐  Early  2007  
    Focus was purely
    development.
    Based on the linux kernel
    Rumors of a handset

    View full-size slide

  40. 2006 Late 2007

    View full-size slide

  41. 2006 Late 2007
    Open Handset Alliance formed

    View full-size slide

  42. 2006 Late 2007
    Open Handset Alliance formed

    View full-size slide

  43. 2006 Late 2007
    Open Handset Alliance formed
    “…to develop open standards for mobile devices”

    View full-size slide

  44. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  

    View full-size slide

  45. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    1.0
    September  23rd  2008  

    View full-size slide

  46. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    1.1
    February  9th  2009  

    View full-size slide

  47. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    1.5
    30th  April  2009  

    View full-size slide

  48. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    1.6
    15th  September  2009  

    View full-size slide

  49. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    2.1
    26th  October  2009  

    View full-size slide

  50. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    2.2
    20th  May  2010  

    View full-size slide

  51. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    2.3
    6th  December  2010  

    View full-size slide

  52. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    3.x
    22nd  February  2011  

    View full-size slide

  53. Version History
    1.0  
    1.1  
    1.5  
    1.6  
    2.0  /  2.1  
    2.2  
    2.3  
    3.x  
    4.0?  
    4.0
    Q4  2011  

    View full-size slide

  54. WE DEMAND
    LAYERS!

    View full-size slide

  55. The Android open-source software stack , based on the linux kernel consists of Java applications
    running on a Java-based object-oriented application framework on top of Java core libraries
    running on a Dalvik virtual machine featuring JIT compilation. Libraries written in C include
    the surface manager, OpenCore media framework, SQLite relational database management
    System, OpenGL ES graphics API, WebKit layout engine and the like.
    Layers  

    View full-size slide

  56. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    } Software Stack

    View full-size slide

  57. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    } Software Stack

    View full-size slide

  58. Linux Kernel
    Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  

    View full-size slide

  59. Linux Kernel
    2.6  
    Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  

    View full-size slide

  60. Linux Kernel
    Security
    memory management
    process management
    network stack
    driver model.
    2.6  
    Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  

    View full-size slide

  61. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    } Software Stack

    View full-size slide

  62. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Middleware

    View full-size slide

  63. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Middleware
    Libraries  
    C  
    C++  
    Exposed through android app framework

    View full-size slide

  64. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Middleware
    Libraries   Android  Run9me  
    C  
    C++  
    Exposed through android app framework
    Dalvik  Virtual  Machine  
    JIT  
    The set of core libraries providing most functionality

    View full-size slide

  65. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  

    View full-size slide

  66. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  

    View full-size slide

  67. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  

    View full-size slide

  68. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  

    View full-size slide

  69. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM   Dalvik  VM  
    Encode,  Execute  

    View full-size slide

  70. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  

    View full-size slide

  71. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Pop  ,  Encode  ,  execute  

    View full-size slide

  72. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Encode,  Execute  

    View full-size slide

  73. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Pop  ,  Encode  ,  execute   Encode,  Execute  

    View full-size slide

  74. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Pop  ,  Encode  ,  execute   Encode,  Execute  
    DX  

    View full-size slide

  75. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Pop  ,  Encode  ,  execute   Encode,  Execute  
    DX  
    .class  
    .class  
    .class  
    .class  

    View full-size slide

  76. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Pop  ,  Encode  ,  execute   Encode,  Execute  
    DX  
    .class  
    .class  
    .class  
    .class  

    View full-size slide

  77. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Pop  ,  Encode  ,  execute   Encode,  Execute  
    DX  
    .class  
    .class  
    .class  
    .class  
    DEX  File  

    View full-size slide

  78. Dalvik Virtual Machine
    -­‐  Dan  Bornstein  
    .dex  
    Memory  
    Processing  Speed  
    Java  VM  
    Stack  based  architecture  
    Dalvik  VM  
    Register  based  architecture  
    Pop  ,  Encode  ,  execute   Encode,  Execute  
    DX  
    .class  
    .class  
    .class  
    .class  
    DEX  File  
    .class  
    .class  
    .class  
    Java  bytecode  (dalvik)  
    Other  Resources  

    View full-size slide

  79. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”

    View full-size slide

  80. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”
    Modes of Runtime Operation

    View full-size slide

  81. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”
    Interpreter   Compilers  

    View full-size slide

  82. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”
    Interpreter   Compilers  
    Translated  from  a  high-­‐level    
    language  to  a  machine  code    
    con9nuously    
    during  every  execu9on  

    View full-size slide

  83. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”
    Interpreter   Compilers  
    Compiled  code  is  translated    
    Into  machine  code  before  
    Execu9on  and  it  requires  
    this  transala9on  only  once  

    View full-size slide

  84. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”
    Interpreter   Compilers  
    Translated  from  a  high-­‐level    
    language  to  a  machine  code    
    con9nuously    
    during  every  execu9on  
    Compiled  code  is  translated    
    Into  machine  code  before  
    Execu9on  and  it  requires  
    this  transala9on  only  once  

    View full-size slide

  85. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”
    Interpreter   Compilers  
    Translated  from  a  high-­‐level    
    language  to  a  machine  code    
    con9nuously    
    during  every  execu9on  
    Compiled  code  is  translated    
    Into  machine  code  before  
    Execu9on  and  it  requires  
    this  transala9on  only  once  

    View full-size slide

  86. JIT  
    Just In Time
    “Method to improve the runtime performance of computer programs.”
    Interpreter   Compilers  
    “A hybrid approach, with translation occurring continuously,
    as with interpreters, but with caching of translated code
    to minimize performance degradation."

    View full-size slide

  87. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Middleware
    Libraries   Android  Run9me  
    C  
    C++  
    Exposed through android app framework
    Dalvik  Virtual  Machine  
    JIT  
    The set of core libraries providing most functionality

    View full-size slide

  88. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    } Software Stack

    View full-size slide

  89. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System

    View full-size slide

  90. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System
    Open  
    Plaborm  

    View full-size slide

  91. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System
    Open  
    Plaborm  
    Rich & Innovative Applications
    Advantage of device H/W , Location info, BG services, etc
    Full access to same API’s used by core applications
    Reusability of components

    View full-size slide

  92. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System
    Open  
    Plaborm  
    Rich & Innovative Applications
    Advantage of device H/W , Location info, BG services, etc
    Full access to same API’s used by core applications
    Reusability of components
    Views  

    View full-size slide

  93. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System
    Open  
    Plaborm  
    Rich & Innovative Applications
    Advantage of device H/W , Location info, BG services, etc
    Full access to same API’s used by core applications
    Reusability of components
    Views   Content  providers  

    View full-size slide

  94. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System
    Open  
    Plaborm  
    Rich & Innovative Applications
    Advantage of device H/W , Location info, BG services, etc
    Full access to same API’s used by core applications
    Reusability of components
    Views   Content  providers  
    Resource  Manager  

    View full-size slide

  95. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System
    Open  
    Plaborm  
    Rich & Innovative Applications
    Advantage of device H/W , Location info, BG services, etc
    Full access to same API’s used by core applications
    Reusability of components
    Views   Content  providers  
    Resource  Manager  
    No9fica9on  Manager  

    View full-size slide

  96. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Operating System
    Open  
    Plaborm  
    Rich & Innovative Applications
    Advantage of device H/W , Location info, BG services, etc
    Full access to same API’s used by core applications
    Reusability of components
    Views   Content  providers  
    Resource  Manager   Ac9vity  Manager  
    No9fica9on  Manager  

    View full-size slide

  97. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    } Software Stack

    View full-size slide

  98. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Key Applications
    Core Applications Java  

    View full-size slide

  99. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    Key Applications
    Core Applications Java  

    View full-size slide

  100. Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  
    } Software Stack

    View full-size slide

  101. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  

    View full-size slide

  102. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  
    Android  
    Key  Applica9ons  
    Opera9ng  System  
    Middleware  
    Linux  Kernel  

    View full-size slide

  103. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  
    2.6  

    View full-size slide

  104. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  

    View full-size slide

  105. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  

    View full-size slide

  106. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  

    View full-size slide

  107. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  
    .dex  

    View full-size slide

  108. The Android open-source software stack is based on the linux kernel and consists of
    Java applications running on a Java-based object-oriented application framework
    sitting on top of core libraries written in C . In Addition , the runtime consists
    of a Dalvik virtual machine featuring JIT compilation
    Layers  
    .dexJIT  

    View full-size slide

  109. Native Applications

    View full-size slide

  110. Java Android SDK

    View full-size slide

  111. Java Android SDK
    Android PacKage

    View full-size slide

  112. Java Android SDK
    Android PacKage
    APK

    View full-size slide

  113. #include
    Void main()
    {
    printf(“Angry Birds”);
    }
    .apk

    View full-size slide

  114. DIE PIGZ ! DIE!

    View full-size slide

  115. Each Application is a User

    View full-size slide

  116. Each Application is a User
    Unique linux user ID
    Chmod 777

    View full-size slide

  117. Each Application is a User
    Unique linux user ID
    Chmod 777
    Each Process has its own VM

    View full-size slide

  118. Each Application is a User
    Unique linux user ID
    Chmod 777
    Each Process has its own VM
    Isolation

    View full-size slide

  119. Each Application is a User
    Unique linux user ID
    Chmod 777
    Each Process has its own VM
    Isolation
    “Principle of least privilege”

    View full-size slide

  120. Each Application is a User
    Unique linux user ID
    Chmod 777
    Each Process has its own VM
    Isolation
    “Principle of least privilege”
    Each  applicato  do  its  work  and  no  more.  

    View full-size slide

  121. Application Components

    View full-size slide

  122. Activities
    Services
    Content Providers
    Broadcast Receivers
    Intents

    View full-size slide

  123. Activities
    Services
    Content Providers
    Broadcast Receivers
    Intents
    5

    View full-size slide

  124. Activities
    Services
    Content Providers
    Broadcast Receivers
    Intents
    5

    View full-size slide

  125. Activities
    Single  smallest  independent  en9ty  
    A single screen with
    A User Interface

    View full-size slide

  126. Services
    Never  underes9mate  the  quiet  guy  in  the  class  
    Runs in the BG performing long-running Operations No UI

    View full-size slide

  127. Filesystem, SQLite
    Content Providers
    Don’t  we  all  love  the  mail  man?  :)  
    Manages a shared set of application data Content provider sets permissions

    View full-size slide

  128. Screen off, Batt low, Data DL
    Broadcast Receivers
    Because  lets  face  it  ,  the  familiar  IPL  sound  broadcasted  makes  us  ROAR!  
    Responds to system wide broadcasts Apps can also broadcast Notification

    View full-size slide

  129. K  
    Intents
    We  NEED  to  know!  
    Activities Services Broadcast Recievers
    +   +  
    KILLER

    View full-size slide

  130. https://market.android.com/publish/signup
    $25.00
    One  9me  registera9on  fee  

    View full-size slide

  131. WE R GREEDY !
    Your Application here :)

    View full-size slide

  132. “Stay Hungry , Stay Foolish”

    View full-size slide