Android Platform
Architecture
By Naresh Chintalcheru
What is Android ?
Android is an open source End-to-End mobile
device platform.
End-to-End Android Platform
Android is an open source End-to-End mobile
device platform.
Open Handset Alliance Project
● Android platform is part of OHA Project
● Consortium of 80 companies led by Google
● OHA members include
○ Mobile Operators (Sprint, T-Mobile, Vodafone)
○ Semiconductor companies (Intel, Qualcomm, TI)
○ Software Companies (eBay, Accenture, Wipro)
○ Handset Manufacturers (Samsung, HTC, Sony, LG)
Android Devices
Although Android usage is primarily focused on
smartphones and tablets, there are many
devices use the platform.
● GPS (Holux)
● Televisions (Sony Internet TV)
● DVD/Blue-Ray Player (Sony)
● Gaming Devices (OUYA Console)
● Vehicles (Chevy Volt)
● Robotics (iRobot Vacuum Cleaner)
● Fitness (Nike+ FuelBand)
Android Platform Architecture
Android Platform Architecture
Android Linux Kernel
● Android is designed to be compatible with wide
array of hardware. This is achieved, in large part
though Linux Kernel, which over the years
evolved.
● Standard Linux 2.6.24 Kernel
● Every application in Android runs in its own
Linux Process with new UserId UID and
GroupId GIU.
● Patch of “kernel enhancements” to support
Why Linux Kernel
• Great memory and process management
• Permissions-based security model
• Proven driver model
• Support for shared libraries
• Itʼs already open source!
Kernel Enhancements
● Power Management
● Low Memory Management
● Kernel Debugger
● Logger
● Alarm
● Binder
Android Platform Architecture
Android Libraries
● C/C++ libraries
● Interface through Java
● Surface manager – Handling UI Windows
● 2D and 3D graphics
● Media codecs, SQLite, Browser engine
Android Runtime
Cheating Java & JVM ?
Android Runtime
Android only uses Java Programming Language
syntax.
Does not use JVM, uses custom built virtual
machine called Dalvik VM.
Uses Apache Harmony for Java Core Library.
Android Runtime
Does not use J2ME
J2ME Vs Android
Android's JVM implementation, called Dalvik VM,
uses a different instruction set from Sun's JVM.
Substantial transformation has to be applied to the
compiled Java byte-code. The result is a 'DEX' file,
which can contain the transformed versions of
multiple compiled .class files.
Android applications may be allowed access to
files, hardware, and network connections, while
J2ME almost always prohibits resource access.
J2ME Vs Android
J2ME Android
Hello.class Hello.dex
Hello.jar Hello.apk
MIDLet Screen Activity Screen
JVM DVM
J2ME Vs Android
J2ME is platform independent.
Android based Java programs are NOT platform
independent and works only Android Platform.
J2ME Vs Android
An uncompressed .dex file is typically a few
percent smaller in size than a compressed .jar
(Java Archive) derived from the same .class files
Multiple classes are included in a single .dex file.
Duplicate strings and other constants used in
multiple class files are included only once in the .
dex output to conserve space.
Java bytecode is also converted into an alternative
instruction set used by the Dalvik VM
DVM
Dalvik Virtual Machine
● Unlike Java VMs, which are stack machines, the
Dalvik VM is a register-based architecture
● Supports multiple virtual machine processes per
device
● Highly CPU-optimized bytecode interpreter
● Uses runtime memory very efficiently
● Runs optimized file format (.dex) and Dalvik
bytecode
● Java .class / .jar files converted to .dex at build
time
Dalvik Virtual Machine
Every Android Application get its own copy of
Dalvik VM
Android Platform Architecture
Application Frameworks
API interface
• Activity Manager
• Package Manager
• Window Manager
• Resource Manager
• Content Providers
• View System
Android Platform Architecture
Built-in Applications
•Built in and user apps
•Can replace built in apps
Android Apps
No Java main() method in Android platform.
Android Apps
The four Application building blocks called
components in Android are ...
1. Activity
2. Service
3. ContentProvider
4. Broadcast Receiver
Activities
•Typically correspond to one UI screen
•But, they can:
–Be faceless
–Be in a floating window
–Return a value
Services
•Faceless components that run in the
background
–E.g. music player, network download etc…
Content Providers
•Enables sharing of data across applications
–E.g. address book, photo gallery
•Provides uniform APIs for:
–querying
–delete, update and insert.
•Content is represented by URI and MIME
type
Broadcast Receiver
Platform Notification System
A broadcast receiver is a component that responds
to system-wide broadcast announcements. Many
broadcasts originate from the system—for
example, a broadcast announcing that the screen
has turned off, the battery is low.
Intents
Intents are objects used as Inter-Component
signaling and Screen Navigations
‣ Starting the user interface for an application
‣ Sending a message between components
‣ Starting a background service
Android Security Model
Permission-based Security Model
Android Security Model
Android is a privilege-separated operating
system, in which each application runs with a
distinct system identity (Linux user ID and
group ID)
Protect the App code using code Obfuscation.
Now ProGuard is included as part of Android
development tool.
Android Security Model
User Permissions in the AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.
com/apk/res/android"
package="com.android.app.myapp" >
<uses-permission android:name="android.permission.
RECEIVE_SMS" />
...
</manifest>
Android Security Model
User Permissions in the AndroidManifest.xml
android.permission.SEND_SMS
android.permission.INTERNET
android.permission.READ_CONTACTS
Thank You
and
Your Feedback is appreciated

Android Platform Architecture

  • 1.
  • 2.
    What is Android? Android is an open source End-to-End mobile device platform.
  • 3.
    End-to-End Android Platform Androidis an open source End-to-End mobile device platform.
  • 4.
    Open Handset AllianceProject ● Android platform is part of OHA Project ● Consortium of 80 companies led by Google ● OHA members include ○ Mobile Operators (Sprint, T-Mobile, Vodafone) ○ Semiconductor companies (Intel, Qualcomm, TI) ○ Software Companies (eBay, Accenture, Wipro) ○ Handset Manufacturers (Samsung, HTC, Sony, LG)
  • 5.
    Android Devices Although Androidusage is primarily focused on smartphones and tablets, there are many devices use the platform. ● GPS (Holux) ● Televisions (Sony Internet TV) ● DVD/Blue-Ray Player (Sony) ● Gaming Devices (OUYA Console) ● Vehicles (Chevy Volt) ● Robotics (iRobot Vacuum Cleaner) ● Fitness (Nike+ FuelBand)
  • 6.
  • 7.
  • 8.
    Android Linux Kernel ●Android is designed to be compatible with wide array of hardware. This is achieved, in large part though Linux Kernel, which over the years evolved. ● Standard Linux 2.6.24 Kernel ● Every application in Android runs in its own Linux Process with new UserId UID and GroupId GIU. ● Patch of “kernel enhancements” to support
  • 9.
    Why Linux Kernel •Great memory and process management • Permissions-based security model • Proven driver model • Support for shared libraries • Itʼs already open source!
  • 10.
    Kernel Enhancements ● PowerManagement ● Low Memory Management ● Kernel Debugger ● Logger ● Alarm ● Binder
  • 11.
  • 12.
    Android Libraries ● C/C++libraries ● Interface through Java ● Surface manager – Handling UI Windows ● 2D and 3D graphics ● Media codecs, SQLite, Browser engine
  • 13.
  • 14.
    Android Runtime Android onlyuses Java Programming Language syntax. Does not use JVM, uses custom built virtual machine called Dalvik VM. Uses Apache Harmony for Java Core Library.
  • 15.
  • 16.
    J2ME Vs Android Android'sJVM implementation, called Dalvik VM, uses a different instruction set from Sun's JVM. Substantial transformation has to be applied to the compiled Java byte-code. The result is a 'DEX' file, which can contain the transformed versions of multiple compiled .class files. Android applications may be allowed access to files, hardware, and network connections, while J2ME almost always prohibits resource access.
  • 17.
    J2ME Vs Android J2MEAndroid Hello.class Hello.dex Hello.jar Hello.apk MIDLet Screen Activity Screen JVM DVM
  • 18.
    J2ME Vs Android J2MEis platform independent. Android based Java programs are NOT platform independent and works only Android Platform.
  • 19.
    J2ME Vs Android Anuncompressed .dex file is typically a few percent smaller in size than a compressed .jar (Java Archive) derived from the same .class files Multiple classes are included in a single .dex file. Duplicate strings and other constants used in multiple class files are included only once in the . dex output to conserve space. Java bytecode is also converted into an alternative instruction set used by the Dalvik VM
  • 20.
  • 21.
    Dalvik Virtual Machine ●Unlike Java VMs, which are stack machines, the Dalvik VM is a register-based architecture ● Supports multiple virtual machine processes per device ● Highly CPU-optimized bytecode interpreter ● Uses runtime memory very efficiently ● Runs optimized file format (.dex) and Dalvik bytecode ● Java .class / .jar files converted to .dex at build time
  • 22.
    Dalvik Virtual Machine EveryAndroid Application get its own copy of Dalvik VM
  • 23.
  • 24.
    Application Frameworks API interface •Activity Manager • Package Manager • Window Manager • Resource Manager • Content Providers • View System
  • 25.
  • 26.
    Built-in Applications •Built inand user apps •Can replace built in apps
  • 27.
    Android Apps No Javamain() method in Android platform.
  • 28.
    Android Apps The fourApplication building blocks called components in Android are ... 1. Activity 2. Service 3. ContentProvider 4. Broadcast Receiver
  • 29.
    Activities •Typically correspond toone UI screen •But, they can: –Be faceless –Be in a floating window –Return a value
  • 30.
    Services •Faceless components thatrun in the background –E.g. music player, network download etc…
  • 31.
    Content Providers •Enables sharingof data across applications –E.g. address book, photo gallery •Provides uniform APIs for: –querying –delete, update and insert. •Content is represented by URI and MIME type
  • 32.
    Broadcast Receiver Platform NotificationSystem A broadcast receiver is a component that responds to system-wide broadcast announcements. Many broadcasts originate from the system—for example, a broadcast announcing that the screen has turned off, the battery is low.
  • 33.
    Intents Intents are objectsused as Inter-Component signaling and Screen Navigations ‣ Starting the user interface for an application ‣ Sending a message between components ‣ Starting a background service
  • 34.
  • 35.
    Android Security Model Androidis a privilege-separated operating system, in which each application runs with a distinct system identity (Linux user ID and group ID) Protect the App code using code Obfuscation. Now ProGuard is included as part of Android development tool.
  • 36.
    Android Security Model UserPermissions in the AndroidManifest.xml <manifest xmlns:android="http://schemas.android. com/apk/res/android" package="com.android.app.myapp" > <uses-permission android:name="android.permission. RECEIVE_SMS" /> ... </manifest>
  • 37.
    Android Security Model UserPermissions in the AndroidManifest.xml android.permission.SEND_SMS android.permission.INTERNET android.permission.READ_CONTACTS
  • 38.