Android architecture is a software stack of components to support mobile device needs. Android software stack contains a Linux Kernel, a collection of c/c++ libraries which are exposed through application framework services, runtime, and application.
The major components of the android platform:
- Linux kernel
- Hardware Abstraction Layer (HAL)
- Native C/C++ Libraries
- Android Runtime
- Application Framework
- System Apps
A kernel is the first layer of software that interacts with the device hardware. The kernel is responsible for providing a basic architectural model for process scheduling, resource handling, memory management, networking, isolation, etc. It must be noted that while Android is built on Linux Kernel, Google has maintained its own forked version of Linux Kernel specifically for android since 2010.
The Linux Kernel 2.6 includes these features:
Process Management – Linux Kernel is responsible for start-stop and executing the program. For a beginner, a process can be thought of as an instance of a computer program.
Driver Model – As evident, this is the layer where all the device-specific drivers run. Here Linux ensures that your application is able to run on Android. Manufacturers/ hardware vendors can develop their drivers into Linux in a familiar environment. That is giving plenty of room for hardware vendors to optimize OS.
File System Management – Linux also manages the file system which in turn controls the data storage service for android devices.
The Linux Kernel houses the drivers needed to make it possible for the operating system to work with different hardware components. These drivers provide a standard interface with which hardware components sourced from different manufacturers can work.
USB Driver – Linux also provides Android with a means to interface with USB devices. Modern devices come with different USB ports, including USB 2.0, and new versions of USB, including USB-C. These drivers make it possible to use the USB port to charge, transfer live data such as logs from the Android devices, and interact with the android file system.
Bluetooth Driver – Linux Kernel provides support for interfacing with Bluetooth hardware components. It provides a way to read and write data received from supported Bluetooth radio frequencies. It also provides a set of facilities for Android to configure Bluetooth.
Wifi Driver – The Linux kernel provides drivers to integrate the WiFi networking hardware components. WiFi components embedded in mobile devices enable Android devices to connect to wifi networks. The driver enables the wifi components to broadcast wifi networks and create hotspots.
Display Driver – Android makes it possible to interface with display components. For most devices, the interface component is an LCD touch-screen. It allows support for configuring and drawing pixels.
Audio Driver – Android devices commonly come with hardware components for audio input and output. Audio drivers in the kernel enable the Android system to use audio received from these components and also produce audio output.
Hardware Abstraction Layer (HAL)
The hardware abstraction layer (HAL) provides standard interfaces that expose device hardware capabilities to the higher-level Java API framework. The HAL consists of multiple library modules, each of which implements an interface for a specific type of hardware component, such as the camera or Bluetooth module. When a framework API makes a call to access device hardware, the Android system loads the library module for that hardware component.
When an Android app is built within Android Studio it is compiled into an intermediate bytecode format (referred to as DEX format). When the application is subsequently loaded onto the device, the Android Runtime (ART) uses a process referred to as Ahead-of-Time (AOT) compilation to translate the bytecode down to the native instructions required by the device processor. This format is known as Executable and Linkable Format (ELF).
Each time the application is subsequently launched, the ELF executable version is run, resulting in faster application performance and improved battery life.
This contrasts with the Just-in-Time (JIT) compilation approach used in older Android implementations whereby the bytecode was translated within a virtual machine (VM) each time the application was launched.
Native C/C++ Libraries
The Android platform provides Java framework APIs to expose the functionality of some of these native libraries to apps. For example, you can access OpenGL ES through the Android framework’s Java OpenGL API to add support for drawing and manipulating 2D and 3D graphics in your app.
we will see some of the core libraries that are present in the Android operating system.
WebKit – This is an open-source Browser engine used as a basis to build browsers. The default Android browser before version 4.4 KitKat uses it for rendering web pages. It enables application developers to render web components in the view system by using WebView. This enables apps to integrate web components into their functionality.
OpenGL – Android also comes with the OpenGL graphics system. It’s a C library that helps Android use hardware components in the real-time rendering of 2D and 3D graphics.
Media Framework – Android also natively supports popular media codecs, making it easy for apps created on the Android platform to use/play multimedia components out of the box.
The Application Framework is a set of services that collectively form the environment in which Android applications run and are managed. This framework implements the concept that Android applications are constructed from reusable, interchangeable, and replaceable components.
The Application framework exposes a safe and uniform means to utilize Android device resources.
Let’s see the Application framework components in detail.
Content Providers – That enable apps to access data from other apps, such as the Contacts app, or to share their own data.
View System – An extensible set of views used to create application user interfaces.
Android Application framework contains device managers to manage the system functions.
Activity Manager – An Activity Manager that manages the lifecycle of apps and provides a common navigation back stack.
Location Manager – Provides access to the location services allowing an application to receive updates about location changes.
Package Manager – Provides access to information about installed applications. Android keeps track of application information such as installation and uninstallation events, permissions the app requests, and resource utilization such as memory consumption.
Notification Manager – The Notification Manager is responsible for informing Android users of application events. It does this by giving users visual, audio, or vibration signals or a combination of them when an event occurs.
Resource Manager – Providing access to non-code resources such as localized strings, graphics, and layout files.
Telephony Manager – Provides information to the application about the telephone services available on the device such as status and subscriber information.
Window Manager – Android uses the Window manager to provide this information to the apps and the system as they run so that they can adapt to the mode the device is running on.
This is the layer that end-users interact with. It is on this layer where application developers publish their applications to run.
Android comes with a set of core apps for email, SMS messaging, calendars, internet browsing, contacts, and more. Apps included with the platform have no special status among the apps the user chooses to install. So a third-party app can become the user’s default web browser, SMS messenger, or even the default keyboard (some exceptions apply, such as the system’s Settings app).
You can check your systems apps under the device settings. this will vary based on the device manufacturers.