lecture 2(b) android internals a quick overview

18
Lecture 2(B): Android Internals: A Quick Overview Ahsanul Karim [email protected] http://droidtraining.wordpress.com Android Application Development 1. What is Android 2. The Android Stack 3. Android SDK 4. Features of Android SDK 5. Application Build Process 6. How Apps Run

Upload: ahsanul-karim

Post on 09-May-2015

560 views

Category:

Education


1 download

TRANSCRIPT

Page 1: Lecture 2(b) Android Internals A Quick Overview

Lecture 2(B): Android Internals: A Quick Overview

Ahsanul [email protected]

http://droidtraining.wordpress.com

Android Application Development

1. What is Android2. The Android Stack3. Android SDK4. Features of Android SDK5. Application Build Process6. How Apps Run

Page 2: Lecture 2(b) Android Internals A Quick Overview

1. What is Android

2. The Android Stack

3. Android SDK

4. Features of Android SDK

5. Application Build Process

6. How Apps Run

Android Internals: Overview We'll Discuss...

Page 3: Lecture 2(b) Android Internals A Quick Overview

What is Android?

Android Internals: Overview What is Android...

An Open Platform for Mobile Applications Development

The first truly open and comprehensive platform for mobile devices with all of the software to run a mobile phone but without the proprietary obstacles that have hindered mobile innovation

- Andy Rubin

A Software Stack for devices including mobiles, tablets and televisions with:

1. Operating System 2. Middleware3. Key Applications

Page 4: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview The Android Stack...

Page 5: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview The Android Stack [1]The Stack: Linux Kernel

Android runs on Linux Kernel.

Kernel provides:1. Hardware Abstraction2. Memory Management3. Process Management4. Networking

Users never see this.

[adb shell commands opens Linux.. will see it later...]

Page 6: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview The Android Stack [2]The Stack: Native Libraries

1. Bionic, a fast and small GPL-based libc library2. Surface Manager, window manager [off-screen buffering]3. 2D+3D Graphics OpenGL4. Media Codecs, offers support for audio/video codecs5. SQLite Database Library6. WebKit Library for better HTML rendering

Page 7: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview The Android Stack [3]The Stack: Android Runtime

1. Optimized2. Small Memory Footprints3. Register based Architecture4. Security Model

Dalvik VM

We'll discuss application build process later in this session

Page 8: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview The Android Stack [4]The Stack: Application Framework1. Activity Manager controls the lifecycle of the application

2. Resource Manager manages everything that is not the code

3. Location Manager figures out the location of the phone [GPS, GSM, WiFi]

4. Notification Manager for events such as arriving messages, appointments etc.

Page 9: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview The Android Stack [5]The Stack: Applications

Shipped Apps:Example: Email client, SMS program, Calendar, Maps, Browser, Contacts etc.

Third Party Apps:

This is where we are

Page 10: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview Android SDK [1]

Page 11: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview Android SDK [2]Includes everything required to Develop, Test & Debug

Android APIs API Libraries provide developers access to the Android stack. Same libraries are used by Google for shipped application

Development Tools Tools that are used to build applications from source files to executables. [dx, aapt etc]

Emulator + AVD Manager

Emulator running in ADVs to simulate device hardware configuration lets developers test applications

Documentation Reference documentation and developer guide

Sample Code Sample application source code for different features and API libraries

Online Support http://developer.android.com + a vibrant developer community

Page 12: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview SDK Features [1]Features/APIs

Connectivity + Telephony

GSM, EDGE, 3G, 4G and LTE Data Transfer+Calls and SMS

Location API For GPS and Network based location detection

MAP Controls Full support for map integration+controls

Multimedia Full multimedia hardware control[Camera+Recorder: Audio+Video+Still Images]

Sensors APIs for using sensor hardware including accelerometer, compass, barometer etc.

Bluetooth & NFC Peer to peer communication

Wi-Fi Wi-Fi hardware access

Storage SQLite Database

Page 13: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview SDK Features [2]

Features/APIs

Shared Data Stores Shared Data Stores, APIs fr contacts, Social Networks, Calendar and Multimedia

Background Services Support for Background Services and Processes

MAP Controls Full support for map integration+controls

Widgets Home-screen Widgets and Live Wallpaper

WebKit Integrated HTML5 WebKit based browser

OpenGL Mobile optimized hardware-accelerated 2D and 3D graphics support

Localization Localization through dynamic resource framework

Reuse Components Framework encourages reuse of application components

Page 14: Lecture 2(b) Android Internals A Quick Overview

Build Process [1]

Page 15: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview Build Process [2]

Android Runtime

.class file

.class file

.class file

dx Tool

Resources

Manifest

.dex file aapt.apk App Package

Page 16: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview How Apps Run [1]The .apk file is installed on a device, and lives in its own security sandbox

1. Android OS- a multi-user Linux system in which each application is a different user.

2. System assigns each app a unique Linux user ID. The system sets permissions for all the files in an application so that only the user ID assigned to that application can access them.

3. Each process has its own VM, so app's code runs in isolation from other apps.

4. By default, every application runs in its own Linux process. Android starts the process when any of the application's components need to be executed, then shuts down the process when it's no longer needed/when the system must recover memory for other applications.

In this way, the Android system implements the principle of least privilege.

Page 17: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview How Apps Run [2]The .apk file is installed on a device, and lives in its own security sandbox

Linux Kernel

Linux Process

Dalvik Virtual Machine

Android Application

Page 18: Lecture 2(b) Android Internals A Quick Overview

Android Internals: Overview Questions...

At the end of the day, the questions we ask of ourselves determine the type of people that we will

become.

-Leo Babauta