Android is becoming very popular these and mostly everyone is crazy about it. So today with the help of a simple diagram I am going to explain the architecture of Android. I think that there is no need to tell you all about the "Android" as everyone who knows about it should also know this simple definition of Android:

"Android is a software stack for mobile devices that includes an operating system, middleware and key applications."

OR

"Android is software platform for mobile devices based on the Linux Operating System and developed by Google and the open Handset Alliance."

INFO:

The Android SDK provides the tools and libraries necessary to begin developing applications that run on Android-powered devices. It supports:

ARCHITECTURE:

Architecture of Android

Architecture of Android

1. Applications:

Android applications are written in the Java programming language, and they run within a virtual machine (VM). It's important to note that the VM is not a JVM as we might expect, but is the Dalvik Virtual Machine, an open source technology. Each Android application runs within an instance of the Dalvik VM, which in turn resides within a Linux-kernel managed process, as shown below. Some of basic applications include a calendar, email client, SMS program, maps, making phone calls, accessing the Web browser, accessing our contacts list and others.

Architecture of Android

2. Application Framework:

This is the skeleton or framework which all android developers have to follow. The developers can access all framework APIs an manage phone's basic functions like resource allocation, switching between processes or programs, telephone applications, and keeping track of the phone's physical location. Underlying all applications is a set of services and systems, including:
  1. Activity Manager
  2. Windows Manager
  3. Content Provider
  4. View System
  5. Package Manager
  6. Telephony Manager
  7. Resource Manager
  8. Location Manager
  9. Notification Manager

Where,
3. Libraries:

This layer consists of Android libraries written in C, C++, and used by various systems. These libraries tell the device how to handle different kinds of data and are exposed to Android developers via Android Application framework. Some of these libraries includes media, graphics, 3d, SQLite, web browser library etc.

Android Libc implementation:

A custom implementation, optimized for embedded use.

Storage, rendering, multimedia:

Provides the main features on the Android platform:

Surface Manager:

Provides a system-wide surface "composer" to render all the surfaces in a frame buffer.

Audio Manager:

Processes multiple audio streams into PCM audio out paths.

Hardware Abstraction Libraries:

Defines the interface that Android requires hardware "drivers" to implement.

The Android runtime layer which includes set of core java libraries and DVM (Dalvik Virtual Machine) is also located in same layer.

Hardware Abstraction Libraries Android

4. Android Runtime:

This layer includes set of base libraries that are required for java libraries. Every Android application gets its own instance of Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently and it executes files in executable (.Dex) optimized for minimum memory.

Dalvik Virtual Machine:

An interpreter-only virtual machine (no JIIT), register based.

5. Linux Kernel:

This layer includes Android's memory management programs, security settings, power management software and several drivers for hardware, file system access, networking and inter-process-communication. The kernel also acts as an abstraction layer between hardware and the rest of the software stack.

A Linux 2.6.24 fit for Android:

Some common features have been removed

New Android specific components have been added
Power Management:

Based on the standard Linux Power Management, Android has its own component.

Power Management Android

Binder:

Driver to facilitate inter-process communication between applications and services.


PLATFORM INITIALIZATION:

PLATFORM INITIALIZATION Android


Explanation:

Explanation Android The bootloader loads the "kernel" and starts the "Init" process. Then,

Explanation Android "Daemons" for handling low level hardware interfaces are started up (USB, ADB,
debugger, radio). After that,
"Zygote", the initial Dalvik VM process is created, and
"Runtime" process initiates the "Service Manager", a key element for "Binders"
and IPC communication.

Explanation Android "Runtime" process requests "Zygote" to start a new instance of Dalvik for running the
"System Server"

Explanation AndroidThe two first processes are able to handle graphic and audio outputs

Explanation AndroidAll the others android components are then started.

ANDROID GUI ARCHITECTURE:

ANDROID GUI ARCHITECTURE

Android GUI is single-threaded, event-driven and built on a library of nestable components. The Android UI framework is organized around the common Model-View-Controller pattern.

The Model: The model represents data or data container. We can see it as a database of pictures on our device. Let's say, any user wants to hear an audio file, he clicks play button and it triggers an event in our app, now the app will get data from data store or database and as per input and creates data to be sent back to the user. We can refer this data as Model.

The View: The View is the portion of the application responsible for rendering the display, sending audio to speakers, generating tactile feedback, and so on.

Now as per above example, the view in a hypothetical audio player might contain a component that shows the album cover for the currently playing tune. User will always interact with this layer. User action's on this layer will trigger events that will go to the application functions.

The Controller: The Controller is the portion of an application that responds to external actions: a keystroke, a screen tap, an incoming call, etc. It is implemented as an event queue. On User's action, the control is passed over to controller and this will take care of all logic that needs to be done and prepare Model that need to be sent to view layer.