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  
  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. SDK

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

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

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

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

    2.0  /  2.1   2.2   2.3   3.x   4.0?  
  10. 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  
  11. 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  
  12. 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  
  13. 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  
  14. 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  
  15. 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  
  16. 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  
  17. 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  
  18. 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  
  19. 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  
  20. Linux Kernel 2.6   Android   Key  Applica9ons   Opera9ng

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

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

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

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

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

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

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

      Processing  Speed   Java  VM   Stack  based  architecture   Dalvik  VM   Register  based  architecture   Pop  ,  Encode  ,  execute   Encode,  Execute  
  29. 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  
  30. 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  
  31. 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  
  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   DX   .class   .class   .class   .class   DEX  File  
  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   .class   .class   .class   .class   DEX  File   .class   .class   .class   Java  bytecode  (dalvik)   Other  Resources  
  34. JIT   Just In Time “Method to improve the runtime

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

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

    performance of computer programs.” Interpreter   Compilers  
  37. 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  
  38. 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  
  39. 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  
  40. 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  
  41. 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."
  42. 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
  43. Android   Key  Applica9ons   Opera9ng  System   Middleware  

    Linux  Kernel   Operating System Open   Plaborm  
  44. 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
  45. 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  
  46. 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  
  47. 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  
  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 Views   Content  providers   Resource  Manager   No9fica9on  Manager  
  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   Content  providers   Resource  Manager   Ac9vity  Manager   No9fica9on  Manager  
  50. Android   Key  Applica9ons   Opera9ng  System   Middleware  

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

    Linux  Kernel   Key Applications Core Applications Java  
  52. 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  
  53. 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  
  54. 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  
  55. 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  
  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  
  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   .dex  
  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   .dexJIT  
  60. APK

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

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

    777 Each Process has its own VM Isolation “Principle of least privilege”
  63. 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.  
  64. Services Never  underes9mate  the  quiet  guy  in  the  class  

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

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

    Broadcast Recievers +   +   KILLER