You are here
Home > HelloWorld >

Android Architecture

Android architecture is the structure of how android actually works in low level. There are several layers that shows how processes works on Android. Android architecture includes Android Run-time Applications, Native C and C++ libraries that were used to build Android. Some other frameworks on the Top of Linux kernel which connects hardware to the software.

The Android software stack
Architecture

Contents

Linux kernel

At the bottom of the layers is Linux.This provides a level of abstraction between the device hardware and it contains all the essential hardware drivers like camera, keypad, display etc. Also, the kernel handles all the things that Linux is really good at such as networking and a vast array of device drivers. For example, the Android Run-time (ART) relies on the Linux kernel for underlying functionalities such as threading and low-level memory management.

Hardware Abstraction Layer (HAL)

On top of Linux kernel there is an Android Hardware Abstraction Layer.It is an interface for hardware vendors to implement that allows the Android application/framework to communicate with hardware-specific device drivers. The Android application uses HAL APIs to get service from hardware devices.Android HAL uses the functions provided by the lower-layer Linux kernel to serve the request from the Android application/framework.

Android Run-time(ART)

This is the third section of the architecture and available on the second layer from the bottom. This section provides a key component called Dalvik Virtual Machine which is a kind of Java Virtual Machine specially designed for Android.This use Linux core features like memory management and multi-threading.It also enables every Android application to run in its own process, with its own instance of the Dalvik virtual machine.

The Android runtime also provides a set of core libraries which enable Android application developers to write Android applications using standard Java programming language.
Features Of ART:

  • Ahead-of-time (AOT) and just-in-time (JIT) compilation
  • Optimized garbage collection (GC)
  • On Android 9 (API level 28) and higher, conversion of an app package’s Dalvik Executable format (DEX) files to more compact machine code.
  • Better debugging support, including a dedicated sampling profiler, detailed diagnostic exceptions and crash reporting, and the ability to set watchpoints to monitor specific fields

Native C/C++ Libraries

Although most android applications are written in Java, there are special scenarios where you may require to use C/C++ . Many core Android system components and services are built from native code.This native codes are embedded in native libraries written in C and C++. The Android platform provides Java framework Application Program Interfaces to use the functionality of some of these native libraries to apps.For Example,You just want to access the device’s physical components like sensors, or touch (This can be done using Java, but using C/C++ helps you communicate directly).

NDK

The NDK (Native Development Kit) is a tool that allows to program in C/C++ for Android devices.It works with the basic standalone SDK tools.

Java API Framework

The Android team has built on a known set proven libraries, built in the background, and all of it these is exposed through Android interfaces. These interfaces wrap up all the various libraries and make them useful for the Developer.

  • View System: It builds the user interface by handling the views and layouts.
  • Resource Manager: It provides access to non-code resources.
  • Notification Manager: It enables all apps to display custom alerts in the status bar.
  • Activity Manager: It manages the activity lifecycle and the activity stack.

System Apps

Android applications can be found at the topmost layer. At application layer we write our application to be installed on this layer only. Examples of applications are Games, Messages, Contacts etc.

Leave a Reply

Top