Programming with Android: System Architecture Luca Bedogni Dipartimento di Scienze dell’Informazione Università di Bologna
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
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
Android … What? ANDROID MICROWAVE SMART FRIDGE ? SMARTPHONES TABLETS EREADERS ANDROID TV GOOGLE GLASSES Luca Bedogni - Programming with Android – System Architecture 4
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
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
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
Android … market share Luca Bedogni - Programming with Android – System Architecture 8
Android … heterogeneity http://opensignal.com/reports/fragmentation-2013/ 11,868 different devices in 2013! Luca Bedogni - Programming with Android – System Architecture 9
Android … heterogeneity http://opensignal.com/reports/2015/08/android-fragmentation/ 24,093 different devices in 2015! Luca Bedogni - Programming with Android – System Architecture 10
Android … heterogeneity http://opensignal.com/reports/2015/08/android-fragmentation/ 24,093 different devices in 2015! Luca Bedogni - Programming with Android – System Architecture 11
Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 12
Android … heterogeneity 2013 2015 Luca Bedogni - Programming with Android – System Architecture 13
Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 14
Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 15
Android … heterogeneity http://developer.android.com/about/dashboards/index.html Luca Bedogni - Programming with Android – System Architecture 16
Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 17
Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 18
Android … heterogeneity Luca Bedogni - Programming with Android – System Architecture 19
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
The Android Architecture Luca Bedogni - Programming with Android – System Architecture 21
The Android Architecture Built on top of Linux kernel Advantages: Ø Portability (i.e. easy to compile on different hardware architectures) Ø Security (e.g. secure multi-process environment) Ø Power Management Ø ART relies on the kernel for threads and memory management Ø Manufacturers build on top of a reliable kernel Luca Bedogni - Programming with Android – System Architecture 22
Kernel Security v User based permission model v Processes are isolated v Inter-process communication (IPC) v Resources are protected from other processes v Each application has its own User ID (UID) v Sandbox v Verified boot Luca Bedogni - Programming with Android – System Architecture 23
The Android Architecture HAL Advantages: Ø Shadows the real device Ø Manages different devices of the same type Ø Standard interfaces to expose lower level capabilities to higher level APIs Luca Bedogni - Programming with Android – System Architecture 24
HAL Ø Standard interface that manufacturers have to implement – Android is agnostic about lower level driver implementations Ø Application developers rely on common APIs Ø Depending on the hardware , appropriate libraries are loaded Luca Bedogni - Programming with Android – System Architecture 25
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 26
Android NDK Ø Enables C/C++ coding Ø Useful if you want to interact/extend with some native libraries Ø Performance Ø Reuse your C/C++ libraries Ø JAVA APIs are provided for most used libraries Ø NDK can be installed as an Android Studio plugin public class myNDKActivity extends Activity { public native void doNothing(): } Luca Bedogni - Programming with Android – System Architecture 27
The Android Architecture APIs (Core Components of Android) Ø Activity Manager Ø Packet Manager Ø Telephony Manager Ø Location Manager Ø Contents Provider Ø Notification Manager Ø …. Luca Bedogni - Programming with Android – System Architecture 28
Java APIs Ø View System Ø Through which you build the APP UI Ø Resource Manager Ø Through which you handle resources Ø Notification Manager Ø Through which you can access to different kind of notifications Ø Activity Manager Ø Which handles the Activity lifecycle Ø Content Providers Ø To share data among APPs Luca Bedogni - Programming with Android – System Architecture 29
The Android Architecture Applications (Written in Java code) Ø Android Play Store Ø Entertainment Ø Productivity Ø Personalization Ø Education Ø Geo-communication Ø …. Luca Bedogni - Programming with Android – System Architecture 30
The Android Architecture ART (VM) Ø Novel Java Virtual Machine implementation (not using the Oracle JVM) Ø 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 31
ART Ø Starting from Android 5.0, ART is used instead of Dalvik Ø Designed to run multiple VM on low end devices Ø Runs DEX bytecode Ø Ahead-of-time (AOT) and Just-in-time (JIT) compilation Ø AOT: At install time, ART compiles APPs using an on-device tool called dex2oat Ø JIT: code profiling Ø Optimized Garbage collection Luca Bedogni - Programming with Android – System Architecture 32
ART Ø Starting from Android 5.0, ART is used instead of Dalvik Ø Designed to run multiple VM on low end devices Ø Runs DEX bytecode Ø Ahead-of-time (AOT) and Just-in-time (JIT) compilation Ø AOT: At install time, ART compiles APPs using an on-device tool called dex2oat Ø JIT: code profiling Ø Optimized Garbage collection Luca Bedogni - Programming with Android – System Architecture 33
Android Applications Design APPLICATION DESIGN : Ø GUI Definition Ø Events Management Ø Application Data Management Ø Background Operations Ø User Notifications Luca Bedogni - Programming with Android – System Architecture 34
Android Applications Design APPLICATION COMPONENTS Ø Activities & Fragments Ø Intents Ø Services Ø Content Providers Ø Broadcast Receivers Luca Bedogni - Programming with Android – System Architecture 35
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 36
Recommend
More recommend