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

Avatar for Shrayas Rajagopal

Shrayas Rajagopal

July 26, 2011

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  
  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    
  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    
  4. …

  5. …

  6. SDK

  7. …

  8. 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
  9. 2005 2003 August   Google acquires Android, Inc. CW “..Google

    was planning to enter the mobile phone market with this move.
  10. Late 2007 2006 -­‐  Early  2007   Focus was purely

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

    development. Based on the linux kernel Rumors of a handset
  12. Version History 1.0   1.1   1.5   1.6  

    2.0  /  2.1   2.2   2.3   3.x   4.0?  
  13. 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  
  14. 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  
  15. 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  
  16. 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  
  17. 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  
  18. 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  
  19. 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  
  20. 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  
  21. 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  
  22. …

  23. 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  
  24. Linux Kernel 2.6   Android   Key  Applica9ons   Opera9ng

     System   Middleware   Linux  Kernel  
  25. Linux Kernel Security memory management process management network stack driver

    model. 2.6   Android   Key  Applica9ons   Opera9ng  System   Middleware   Linux  Kernel  
  26. Android   Key  Applica9ons   Opera9ng  System   Middleware  

    Linux  Kernel   Middleware Libraries   C   C++   Exposed through android app framework
  27. 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
  28. Dalvik Virtual Machine -­‐  Dan  Bornstein   .dex   Memory

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

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

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

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

      Processing  Speed   Java  VM   Stack  based  architecture   Dalvik  VM   Register  based  architecture   Pop  ,  Encode  ,  execute   Encode,  Execute  
  33. 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  
  34. 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  
  35. 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  
  36. 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  
  37. 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  
  38. JIT   Just In Time “Method to improve the runtime

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

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

    performance of computer programs.” Interpreter   Compilers  
  41. 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  
  42. 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  
  43. 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  
  44. 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  
  45. 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."
  46. 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
  47. Android   Key  Applica9ons   Opera9ng  System   Middleware  

    Linux  Kernel   Operating System Open   Plaborm  
  48. 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
  49. 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  
  50. 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  
  51. 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  
  52. 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  
  53. 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  
  54. Android   Key  Applica9ons   Opera9ng  System   Middleware  

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

    Linux  Kernel   Key Applications Core Applications Java  
  56. 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  
  57. 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  
  58. 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  
  59. 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  
  60. 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  
  61. 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  
  62. 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  
  63. 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  
  64. …

  65. APK

  66. Each Application is a User Unique linux user ID Chmod

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

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

    777 Each Process has its own VM Isolation “Principle of least privilege” Each  applica<on,  by  default,  has  access  only  to  the  components  that  it  requires     to  do  its  work  and  no  more.  
  69. Services Never  underes9mate  the  quiet  guy  in  the  class  

    Runs in the BG performing long-running Operations No UI
  70. Filesystem, SQLite Content Providers Don’t  we  all  love  the  mail

     man?  :)   Manages a shared set of application data Content provider sets permissions
  71. 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
  72. K   Intents We  NEED  to  know!   Activities Services

    Broadcast Recievers +   +   KILLER