luca bedogni
play

Luca Bedogni Dipartimento di Scienze dellInformazione Universit di - PowerPoint PPT Presentation

Programming with Android: System Architecture Luca Bedogni Dipartimento di Scienze dellInformazione Universit di Bologna Outline Android Architecture: An Overview Android Java Virtual Machine Android Components: Activities Android


  1. Programming with Android: System Architecture Luca Bedogni Dipartimento di Scienze dell’Informazione Università di Bologna

  2. Outline Android Architecture: An Overview Android Java Virtual Machine Android Components: Activities Android Components: Intents Android Components: Services Android Components: Content Providers Android Application Distribution and Markets Luca Bedogni - Programming with Android – System Architecture 2

  3. Android … What? v Android is a Linux-based platform for mobile devices … § Operating System § Middleware § Applications § Software Development Kit ( SDK ) v Which kind of mobile devices … (examples) ? SMARTPHONES TABLETS EREADERS ANDROID TV GOOGLE GLASSES Luca Bedogni - Programming with Android – System Architecture 3

  4. Android … What? ANDROID MICROWAVE SMART FRIDGE ? SMARTPHONES TABLETS EREADERS ANDROID TV GOOGLE GLASSES Luca Bedogni - Programming with Android – System Architecture 4

  5. Android … When? 2005 Ø Google buys Android from the Android Inch Ø Open Handset Alliance ( OHA ) created for open 2006 standards for mobile devices. Partners of OHA: Google, Motorola, Samsung, Vodafone, T-Mobile, etc 2007 Ø Android 1.0 Released 2008 Ø The first Android smartphone: G1 HTC-Dream 2009 Ø Android 1.1 Released Ø Android 1.5 (CupCake) Released Time Luca Bedogni - Programming with Android – System Architecture 5

  6. Android … When? Ø Android 1.6 ( Donut ) Released 2008 Ø Android 2.0 ( Eclair ) Released 2009 Ø Android 2.2 ( Froyo ) Released 2010 Ø Android 2.3 ( Gingerbread ) Released Ø Android 3.0 ( Honeycomb ) Released 2011 (First version for devices with larger screens such as tablets) 2012 Ø Android 4.0 ( Ice-Cream Sandwich ) Released. (It merges the 3.x tab centric design and the v2.x phone based design into a single version.) Time Luca Bedogni - Programming with Android – System Architecture 6

  7. Android … When? Ø Android 4.4 ( Kitkat ) Released 2012 Ø Wireless printing capability 2013 Ø Ability for applications to use "immersive mode” Ø Performance optimization 2014 Ø New experimental runtime virtual machine, ART… API Level 19 (Android 4.4): ANDROID 5.0 Ø Support to new embedded sensors (e.g. STEP_DETECTOR) Ø Adaptive video playback functionalities Ø Read and write SMS and MMS messages (managing default text messaging client) Time Luca Bedogni - Programming with Android – System Architecture 7

  8. Android … market share Luca Bedogni - Programming with Android – System Architecture 8

  9. Android … heterogeneity http://opensignal.com/reports/fragmentation-2013/ 11,868 different devices in 2013! Luca Bedogni - Programming with Android – System Architecture 9

  10. Android … heterogeneity http://opensignal.com/reports/2015/08/android-fragmentation/ 24,093 different devices in 2015! Luca Bedogni - Programming with Android – System Architecture 10

  11. Android … heterogeneity http://opensignal.com/reports/2015/08/android-fragmentation/ 24,093 different devices in 2015! Luca Bedogni - Programming with Android – System Architecture 11

  12. Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 12

  13. Android … heterogeneity 2013 2015 Luca Bedogni - Programming with Android – System Architecture 13

  14. Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 14

  15. Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 15

  16. Android … heterogeneity http://developer.android.com/about/dashboards/index.html Luca Bedogni - Programming with Android – System Architecture 16

  17. Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 17

  18. Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 18

  19. Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 19

  20. Android … When? ANDROID APP CATEGORIES ANDROID APP PRICE http://www.appbrain.com/stats/android-market-app-categories http://www.onlinemarketing-trends.com/2011/07/android- marketplace-top-5-statistics.html Luca Bedogni - Programming with Android – System Architecture 20

  21. The Android Architecture } Stack Architecture Open Source Architecture (Apache/MIT License v. 2.0) Business-friendly License Luca Bedogni - Programming with Android – System Architecture 21

  22. The Android Architecture Built on top of Linux kernel (v. 2.6-3.4) Advantages: Ø Portability (i.e. easy to compile on different hardware architectures) Ø Security (e.g. secure multi-process environment) Ø Power Management Luca Bedogni - Programming with Android – System Architecture 22

  23. The Android Architecture HAL Advantages: Ø Shadows the real device Ø Manages different devices of the same type Luca Bedogni - Programming with Android – System Architecture 23

  24. The Android Architecture Native Libraries (C/C++ code) Ø Graphics (Surface Manager) Ø Multimedia (Media Framework) Ø Database DBMS (SQLite) Ø Font Management (FreeType) Ø WebKit Ø C libraries (Bionic) Ø …. Luca Bedogni - Programming with Android – System Architecture 24

  25. The Android Architecture Application Libraries (Core Components of Android) Ø Activity Manager Ø Packet Manager Ø Telephony Manager Ø Location Manager Ø Contents Provider Ø Notification Manager Ø …. Luca Bedogni - Programming with Android – System Architecture 25

  26. The Android Architecture Applications (Written in Java code) Ø Android Play Store Ø Entertainment Ø Productivity Ø Personalization Ø Education Ø Geo-communication Ø …. Luca Bedogni - Programming with Android – System Architecture 26

  27. The Android Architecture Dalvik Virtual Machine (VM) Ø Novel Java Virtual Machine implementation (not using the Oracle JVM) Ø Open License (Oracle JVM is not open!) Ø Optimized for memory- constrained devices Ø Faster than Oracle JVM Ø ART optional from 4.4, mandatory from 5.0 Luca Bedogni - Programming with Android – System Architecture 27

  28. Dalvik Java Virtual Machine (JVM) Java Source Java Source Java Standard Edition Code Code Java Java Compiler Compiler Java Byte Java Byte Code Code Dex Compiler Stack-based Dalvik Byte byte-code Code Register-based byte-code Java Virtual Dalvik Virtual Machine (JVM) Machine (VM) Luca Bedogni - Programming with Android – System Architecture 28

  29. ART Ø ART introduces ahead-of-time compilation Ø At install time, dex2oat convert dex files to executables Ø Improved garbage collection Ø Only one GC pause Ø Parallelized processes Ø More debugging features Ø Improved diagnostic Luca Bedogni - Programming with Android – System Architecture 29

  30. Android Applications Design APPLICATION DESIGN : Ø GUI Definition Ø Events Management Ø Application Data Management Ø Background Operations Ø User Notifications Luca Bedogni - Programming with Android – System Architecture 30

  31. Android Applications Design APPLICATION COMPONENTS Ø Activities & Fragments Ø Intents Ø Services Ø Content Providers Ø Broadcast Receivers Luca Bedogni - Programming with Android – System Architecture 31

  32. Android Components: Activities Ø An Activity corresponds to a single screen of the Application . Android HelloWorld Ø An Application can be composed of multiples screens (Activities). Button1 Ø The Home Activity is shown when the user Hello World! launches an application. Ø Different activities can exhange information one with each other. Luca Bedogni - Programming with Android – System Architecture 32

  33. Android Components: Activities Ø Each activity is composed by a list of graphics components . Ø Some of these components (also called Views ) can interact with the user by handling events (e.g. Buttons) . Ø Two ways to build the graphic interface: PROGRAMMATIC APPROACH Example: Button button=new Button (this); TextView text= new TextView(); text.setText(“Hello world”); Luca Bedogni - Programming with Android – System Architecture 33

  34. Android Components: Activities Ø Each activity is composed by a list of graphics components . Ø Some of these components (also called Views ) can interact with the user by handling events (e.g. Buttons) . Ø Two ways to build the graphic interface: DECLARATIVE APPROACH Example: < TextView TextView android.text=@string/hello” android:textcolor=@color/blue android:layout_width=“fill_parent” android:layout_height=“wrap_content” /> < Button Button android.id=“@+id/Button01” android:textcolor=“@color/blue” android:layout_width=“fill_parent” android:layout_height=“wrap_content” /> Luca Bedogni - Programming with Android – System Architecture 34

  35. Android Components: Activities EXAMPLE - Build the application layout through XML files (like HTML) - Define two different XML layouts for two different devices Device 1 Device 2 - At runtime , Android detects the HIGH screen pixel density LOW screen pixel density current device configuration and loads the appropriate resources Java App Code for the application - No need to recompile ! - Just add a new XML file if you need to support a new device XML Layout File XML Layout File Device 1 Device 2 Luca Bedogni - Programming with Android – System Architecture 35

Recommend


More recommend