1. Android Application Development
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
Ahsanul Karim
karim.ahsanul@gmail.com
http://droidtraining.wordpress.com
2. Android Internals: 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
We'll Discuss...
3. Android Internals: Overview
What is Android...
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. Middleware
3. Key Applications
5. Android Internals: Overview
The Stack: Linux Kernel
Android runs on Linux Kernel.
Kernel provides:
1. Hardware Abstraction
2. Memory Management
3. Process Management
4. Networking
Users never see this.
[adb shell commands opens
Linux.. will see it later...]
The Android Stack [1]
6. Android Internals: Overview
The Stack: Native Libraries
1. Bionic, a fast and small GPLbased libc library
2. Surface Manager, window
manager [off-screen buffering]
3. 2D+3D Graphics OpenGL
4. Media Codecs, offers
support for audio/video codecs
5. SQLite Database Library
6. WebKit Library for better
HTML rendering
The Android Stack [2]
7. Android Internals: Overview
The Stack: Android Runtime
Dalvik VM
1. Optimized
2. Small Memory Footprints
3. Register based Architecture
4. Security Model
We'll discuss application build
process later in this session
The Android Stack [3]
8. Android Internals: Overview
The Stack: Application Framework
1. 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.
The Android Stack [4]
9. Android Internals: Overview
The Stack: Applications
Shipped Apps:
Example:
Email client, SMS program,
Calendar, Maps, Browser,
Contacts etc.
Third Party Apps:
This is where
we are
The Android Stack [5]
11. 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
12. 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
13. 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
16. 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.
17. 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