Presentation is loading. Please wait.

Presentation is loading. Please wait.

Android: An Open Software Platform for Mobile Devices

Similar presentations


Presentation on theme: "Android: An Open Software Platform for Mobile Devices"— Presentation transcript:

1 Android: An Open Software Platform for Mobile Devices
CHEN Xinyu

2 Outline What is Android? What is Android?
Android application components Android application components Android boot sequence Android boot sequence Binder: Inter-process communication Binder: Inter-process communication Android is a software stack for mobile devices that includes an operating system, middleware and key applications. Conclusion Conclusion

3 Various OSs for Mobile Devices
Google’s Android Apple’s iOS Microsoft’s Windows Phone RIM’s BlackBerry OS Open Source proprietary mobile OS 3

4 Android History Google acquired Android Inc. in Aug. 2005
Open Handset Alliance: Nov. 2007 Google, Intel, Motorola, Nvidia, Samsung, TI, … 1.0 : Oct. 2008 2.3 Gingerbread: Dec. 2010 3.0 Honeycomb: Feb. 2011 A tablet-oriented release 3.2 Honeycomb: July 2011 Google Inc. purchased the initial developer of the software, Android Inc., in 2005 The unveiling of the Android distribution in November 2007 was announced with the founding of the Open Handset Alliance, Google and other members of the Open Handset Alliance collaborated on Android's development and release. 3.0 (Honeycomb) was a tablet-oriented release which supports larger screen devices and introduces many new user interface features Cloud Client? 4

5 Android is not GNU/Linux
Based on Linux kernel 2.6.* Open source Memory management, Process management Permission-based security model Driver model Shared libraries No native windowing system No glibc support Bionic libc: custom libc implementation, optimized for embedded use GPL (GNU General Public License)? Apache license, version 2 Why Linux kernel? Powered by Linux operating system Open source under the Apache license, version 2 Bionic: Size, will load in each process, so it needs to be small Fast, License: Keep GPL out of user-space 5

6 Android Architecture APPLICATIONS (Java)
Home Screen Phone Browser APPLICATION FRAMEWORK (Java/JNI) Activity Manager Window Manager Content Providers View System Package Manager Telephony Manager Resource Manager Location Manager Notification Manager NATIVE LIBRARIES (C/C++) Surface Manager OpenGL | ES SGL FreeType SSL SQLite WebKit libc Media Framework ANDROID RUNTIME Dalvik Virtual Machine Core Libraries (Java) All applications, both native and third-party, are built on the application layer. All applications run on a Java-based application framework. It provides a generic abstraction for hardware access and manages the user interface and application resources. The application framework builds on top of Java core libraries running on a Dalvik virtual machine. Core APIs for Java language provide a powerful, yet simple and familiar development platform Dalvik is a register-based virtual machine that’s been optimized to ensure that a device can run multiple instances efficiently. Dalvik VM: runs optimized file format .dex and Dalvik bytecode Java .class/.jar files converted to .dex at build time Designed for embedded environments Uses runtime memory very efficiently Highly CPU-optimized bytecode interpreter Supports multiple VM processes per device Libraries written in C/C++ include the surface manager, media framework, SQLite relational database management system, Graphics (OpenGL ES 2.0 3D graphics API, SGL graphics engine, FreeType), WebKit layout engine, SSL, and Bionic libc. Surface manager: provides system-wide surface composer Skia Graphics Library Core services (including hardware drivers, process and memory management, security, network, and power management) LINUX KERNEL (C) Display Driver Camera Driver Flash Memory Driver Binder (IPC) Driver Keypad Driver WiFi Driver Audio Drivers Power Management

7 Android Software Development
SDK (Software Development Kit): Java Tools and APIs to begin developing applications Eclipse plug-in QEMU-based handset emulator NDK (Native Development Kit): C/C++ Build applications in native code Fast application development in Java

8 Outline What is Android? Android application components
Android boot sequence Binder: Inter-process communication Conclusion 8

9 Android Application Android application is component-based .apk
Application manifest AndroidManifest.xml Every Android application runs in its own process with its own instance of the Dalvik VM Android applications consist of loosely coupled components, bound by an application manifest that describes each component and how they all interact, as well as the application metadata including its hardware and platform requirements. The manifest lets you define the structure and metadata of your application, its components, and its requirements.

10 Application Building Blocks
Activity Service Content Provider Broadcast Receiver

11 (1) Activity The presentation layer of Android application
Activity Manager View System The presentation layer of Android application Every screen or window is an extension of the android.app.Activity class Activities use Views to form GUI All UI controls are derived from android.view.View android.widget.Button, TextView, ListView, CheckBox, … Activity Manager controls the lifecycle of activities An Activity is an application component that provides a screen with which users can interact in order to do something An application usually consists of multiple activities Activities use views to form GUI to display information and respond to user actions An activity typically corresponds to one UI screen Views are used to construct the user interfaces for Activities Activity Manager controls the life cycle of activities 11

12 The Activity Lifecycle

13 Intent A message-passing mechanism Using Intents to propagate actions
Declare intentions to start new activities explicitly: specifying the class to load implicitly: requesting that an action be performed on a piece of data Broadcast messages across system Using Intents to propagate actions Encourage the decoupling of components Allow the seamless replacement of application elements Intents are used as a message-passing mechanism that works both within your application, and between applications Declare intentions to start new activitis to perform actions, usually with a particular piece of data Broadcast that an event (or action) has occurred Any application can register Broadcast Receivers to listen for, and react to, these broadcast Intents. This lets you create event-driven applications based on internal, system, or third-party-application events. The system will determine the targets that will perform any actions as appropriate Three of the core components of an application — activities, services, and broadcast receivers — are activated through messages, called intents. Intent intent = new Intent(MyActivity.this, MyOtherActivity.class); startActivity(intent); Intent intent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel: ")); startActivity(intent); 13

14 (2) Service android.app.Service
Faceless components that run in the background Used to perform regular processing that needs to continue even when application’s Activities aren’t active or visible E.g. music player, network download, etc. A Service is an application component that can perform long-running operations in the background and does not provide a user interface. 14

15 (3) Content Provider android.content.ContentProvider
Content Providers android.content.ContentProvider Shareable data store Provide an interface for publishing and consuming data Based around a simple URI addressing model using the content:// schema Decouple the application layer from the data layer Native Content Providers Contact, Media store, … They're the only way to share data across applications Offers a generic interface to any data source 15

16 (4) Broadcast Receiver android.content.BroadcastReceiver
Intent broadcast consumer “SMS message received” “incoming phone call” Like global event listener If you create and register a Broadcast Receiver, your application can listen for broadcast Intents that match specific filter criteria If a matching Intent is broadcast, the application will be started automatically and the registered Broadcast Receiver will be run 16

17 Outline What is Android? Android application components
Android boot sequence Binder: Inter-process communication Conclusion 17

18 Android Boot Sequence System Server Android Runtime Activity Manager
Dalvik VM Activity Manager Package Manager Android Runtime Home Dalvik VM registration Daemons adbd rild debuggerd usbd Service Manager Similar to most Linux-based systems at startup, the bootloader loads the Linux kernel and starts the init process Init starts Linux daemons, including: Debugger Daemon (debuggerd) to manage debug processes requests (dump memory, etc.) Android debug bridge Radio interface layer Initializes Service Manager – the context manager for Binder that handles service registration and lookup Init process starts the zygote process: Loads classes and listens on socket for requests to spawn VMs Sends request for Zygote to start System Service Native system servers register with Service Manager as IPC service targets Each subsequent application is launched in it’s own process Contacts Dalvik VM Zygote fork Zygote provides fork service through socket Init Linux Kernel

19 Outline What is Android? Android application components
Android boot sequence Binder: Inter-process communication Conclusion 19

20 Android Task Process A Process B Task Activity Activity Activity
Content Provider Processes are started and stopped as needed to run an application's components Processes may be killed to reclaim resources Applications and Services may run in separate processes but must communicate and share data A task is what the user experiences as an "application." It's a group of related activities, arranged in a stack. A task is a stack of activities, not a class or an element in the manifest file. An application usually contains multiple activities For example, if your application wants to send an , you can define an intent to perform a "send" action and include some data, such as an address and a message. An activity from another application that declares itself to handle this kind of intent then opens. When the is sent, your activity resumes and it seems as if the activity was part of your application. Even though the activities may be from different applications, Android maintains this seamless user experience by keeping both activities in the same task. .apk package Service .apk package 20

21 IPC (Inter-Process Communication)
Linux/UNIX Semaphore Message queue Shared memory Signal Pipe Socket Android Binder

22 Android Binder Driver to facilitate IPC
Light-weight CORBA Client-server High performance through shared memory Per-process thread pool for processing requests Mapping of object references across processes Android Interface Definition Language (AIDL) Objects are stored within an android.os.Parcel Synchronous calls between processes Objects are stored within a Parcel that can be marshaled across process boundaries

23 Binder Driver: /dev/binder
Client Service Manager Server service list IXXX Name:Handle onTransact(…) Name:Handle thread pool Name:Handle Handle=0 transact(…) User Space Service manager: DNS Binder driver: rounter Kernel Space Binder Driver: /dev/binder memory mapping 23

24 Conclusions Android is a software platform for mobile devices working as cloud clients Android is not GNU/Linux Android application is component-based Activity, Service, Content Provider, Broadcast Receiver Android uses Zygote to fork processes Android Binder driver is its IPC mechanism 24

25


Download ppt "Android: An Open Software Platform for Mobile Devices"

Similar presentations


Ads by Google