Android Application Architecture

Android Application Architecture can be easily understand by the following given figure.

android_architecture


The above given figure shows the Architecture of Android OS. Android Operating System can be referred as a software stack of different layer, where each layer is a group of several program components. Together it includes Operating System, middleware and important applications. Each layer in the architecture provides different services to the layer just above it. Mainly layers are divided into five sections and four main layers as shown in the diagram.


Linux Kernel

Linux kernel is the basic layer in Android architecture. Android OS is built on top of the Linux 2.6 Kernel with some further architectural changes made by Google. It never really interacts with the users and developers, but is at the heart of the whole system.
It is this Linux that interacts with the hardware and contains all the essential hardware drivers. Drivers are programs that control and communicate with the hardware. The Linux kernel also acts as an abstraction layer between the hardware and other software layers.

android_kernel


Linux kernel provides the following functions in the Android system:

  • Hardware Abstraction
  • Memory Management Programs
  • Security Settings
  • Power Management Software
  • Other Hardware Drivers
  • Support for Shared Libraries Network Stack

Here is a Table highlighting the different Kernel versions-
Android Versions
Linux Kernel Version
1.0 (Apple Pie)
2.6.25
1.5 (cupcake)
2.6.27
1.6 (Donut)
2.6.29
2.2 (Froyo)
2.6.32
2.3 (Gingerbread)
2.6.35
3.0 (Honeycomb)
2.6.36
4.0.x (Ice Cream Sandwich)
3.0.1
4.1/4.2 (Jelly Bean)
3.0.31


Native Libraries Layer

The next layer is the Android's native libraries. Native Libraries Layer enables the device to handle different types of data. These libraries are written in c or c++ language and are specific for a particular hardware. For instance, the playback and recording of various audio and video formats is guided by the Media Framework Library.

android_libs


Some of the important native libraries include the following:

Surface Manager: Surface Manager used for composing windows on the screen. It is used for compositing window manager with off-screen buffering. Off-screen buffering means you can't directly draw into the screen, but your drawings go to the off-screen buffer. There it is combined with other drawings and form the final screen the user will see. This off screen buffer is the reason behind the transparency of windows.

Media framework: Media framework provides playbacks and recording of various audio, video and picture formats.

SQLite: SQLite is the database used in android for data storage purposes

WebKit: It is the browser engine used to display HTML content

Free Type: Font Rendering

OpenGL | ES: Used to render 2D or 3D graphics content to the screen

libc: System C libraries



Android Runtime

Android Runtime layer consists of Dalvik Virtual machine and Core Java libraries, located on the same level as the libraries layer. Android application programmers build their apps using the Java programming language. It also includes the Dalvik Virtual Machine.

android_runtime_lib


Dalvik Virtual Machine It is a type of JVM responsible for running apps on Android devices and is optimized for low processing power and low memory environments. Unlike the JVM, the Dalvik Virtual Machine doesn't run .class files, instead it runs .dex files. .dex files are built from .class file at the time of compilation and provides higher efficiency in low resource environments.
The Dalvik VM allows multiple instance of Virtual machine to be created simultaneously providing security, isolation, memory management and threading support. Dalvik is an open-source software. Dan Bornstein, who named it after the fishing village of Dalvík in Iceland, where some of his ancestors lived, originally wrote Dalvic VM.


Core Java Libraries These are different from Java SE and Java ME libraries. However these libraries provides most of the functionalities defined in the Java SE libraries.



Application Framework

Our applications directly interact with these blocks of the Android architecture. These programs manage the basic functions of phone like resource management, voice call management etc.

android_app_framework


Important blocks of Application framework are:

Activity Manager: Manages the activity life cycle of applications

Content Providers: Manage the data sharing between applications

Telephony Manager: Manages all voice calls. We use telephony manager if we want to access voice calls in our application

Location Manager: Location management, using GPS or cell tower

Resource Manager: Manage the various types of resources we use in our Application



Application Layer

The Applications are the top layer in the Android architecture and this is where our applications are gonna fit. User of the Android device would mostly interact with this layer (for basic functions, such as making phone calls, accessing the Web browser etc.).

android_applications


Several standard applications comes pre-installed with every device, such as:

  • SMS client app
  • Dialer
  • Web browser
  • Contact manager