Android is a Mobile Operating System developed by Google which is based on modified version of Linux Kernel. Android developed mainly for mobile devices and uses Java Language to write application code. It is an open source software stack which is categorized into following layer,

  1. System Apps
  2. Application Framework
  3. Libraries
  4. Android Runtime
  5. Hardware Adaption Layer
  6. Linux Kernel 

Linux Kernel

Linux Kernel is a foundation of the Android Platform and positioned at bottom most layer of android software stack. Linux Kernel is a heart of android platform and provides a bridge between device hardware and upper layer of android software stack. Android Platform has been built on Linux 2.6 Kernel with some changes. It provides features such as Memory Management, Power Management, Security Management, Network Stack, Device Management and Process Management to android system.

Linux Kernel also contains list of device drivers to communicate Android device to other device. Driver list is shown in figure. Linux Kernel originally developed by Linus Torvalds in 1991.

Hardware Adaption Layer

The Hardware Abstraction Layer (HAL) bridges the gap between hardware and software. It is an interface that allows Android application to communicate with hardware specific device drivers. Android application uses HAL APIs to request service from hardware device and Android HAL uses functions provided by lower layer Linux Kernel to serve respond to the request of Android application.

HAL is a vendor specific layer developed in C/C++ language and it varies from vendor to vendor. It means HAL is hardware specific and its implementation changes according to hardware where it uses.

Android Runtime (ART)

Android Runtime is an application runtime environment used to convert android application’s bytecode to native code. Basically, ART is written to run multiple virtual machines on low-memory devices by executing DEX files. DEX file is bytecode format designed especially for Android to improve execution efficiency and reduce power consumption.

As all knows Android uses Java language, programs are first compiled into Java Class and then it converted into DEX (Dalvik Executable) bytecode files, which then turned into .apk file to install on device.

Following are some features implemented by ART,

Ahead-of-time (AOT) compilation

ART introduced the use of Ahead-Of-Time (AOT) compilation, which compiles entire application into native code at a time of installation. This is one time process done at installation time of Android application, which improves the execution and reduce power consumption by application.

Improved Garbage Collection

ART always keeps track on memory allocation for application. Once ART determines that a piece of memory is no longer being used by the application, it frees memory, without informing the programmer. The mechanism for reclaiming unused memory within a managed memory environment is known as Garbage Collection. 

Garbage collection has two things to do, finding the object in application that will no longer use in future and releasing resources used by that object. By using Garbage Collection mechanism ART improves application performance.

Better Development and Debugging

ART provides support for sampling profiler, more debugging features, detailed diagnostic exceptions and crash reports for better Development and Debugging of application.

ART support sampling profiler to trace an application execution without any slowdown in application execution and reduction in performance. ART provides Breakpoint for specific instance for debugging. ART provide much possible details for exception.

Android Libraries (Java and Native C/C++ Libraries)

This layer provides all Java based libraries used to develop an android application. Java library contains vast list of classes that supports database connectivity, 2D-3D graphics design, messaging service and surface building etc. 

Android applications are develop in Java, but not to forget that the core Android system components and services (Such as ART and HAL) are written in C/C++ language. Android framework provides Java APIs to use native libraries. For example, when programmer uses android.opengl library to draw 2D-3D graphics on device through Android framework, it actually calls OpenGL ES C++ library to complete programmer’s task.

OpenGL ES stands for Open Graphics Library for Embedded System. It is a computer graphics rendering API (Application Programming Interface) for rendering 2D 3D graphics in android application (Such as games).

Application Framework

Application Framework is a set of services written in Java Language which provides an environment for application to run and manage. Android developers use these services in application.

Following services are provided by Android Framework,

  • Activity Manager: manages the activity life cycle of an application
  • Resource Manager: provides access to non code resources such as localized strings, graphics and layout files.
  • Notification Manager: allows all android application to show notification alerts.
  • Content Provider: allows android application to access data from other application and to share data to other application such as Contacts.
  • View System: is used to build application’s User Interface by using android controls.
  • Package Manager: used to find information about other application installed on phone.
  • Location Manager: allows application to access location service.
  • Telephony Service: provides information about telephone service like SIM number, phone network type, subscriber id etc…

System Applications

System Application is positioned at top most layer of Android software stack. Users will interact with Android system through this layer by using native application such as accessing Contacts, Web Browsers, making Calls, games etc. This layer contains both Native applications provided by Android System and third party application which is installed by user.