Skip to main content

Understanding AOSP Architecture: A Comprehensive Guide


AOSP Basics

What is AOSP?

AOSP stands for Android Open Source Project. It’s a project led by Google to develop the Android platform, and it includes everything you need to build an Android OS from scratch. The code is freely available, allowing manufacturers, developers, and hobbyists to create their own versions of Android.

History and Evolution of AOSP

AOSP started with the release of Android in 2008. Over the years, it has evolved significantly, incorporating numerous features, enhancements, and security improvements. Each new version of Android brings updates to AOSP, reflecting the latest innovations in mobile technology.

Differences between AOSP and  Android

While AOSP provides the core of Android, Android includes additional proprietary features and services like Google Play Store, Google Maps, and other Google apps. Manufacturers often use AOSP as the base and then add their own customizations and Google’s services to create the Android experience on their devices. 

AOSP Compatibility and Android Compatibility

There are two levels of compatibility for devices implementing AOSP. An AOSP-compatible device must conform to the list of requirements in the Compatibility Definition Document (CDD). An Android-compatible device must conform to the list of requirements in the CDD and Vendor Software Requirements (VSR) and tests such as those in the Vendor Test Suite (VTS) and Compatibility Test Suite (CTS). 


System Architecture Overview

High-Level Architecture Diagram

At a high level, the AOSP architecture consists of several layers, each serving a distinct purpose:

  1. Linux Kernel
  2. Native Libraries
  3. Hardware Abstraction Layer (HAL)
  4. Android Runtime (ART)
  5. System Services
  6. Android Framework

Now, let’s delve into each layer of the AOSP architecture to understand its role, functionality, and importance.

1.      Linux Kernel

Definition: The Linux kernel is the core part of the Android OS, managing system resources and hardware interactions.

What: It provides basic system functionalities like process management, memory management, and device driver support.

Why: It ensures efficient and secure interaction between hardware and software components.

How: It communicates with hardware via device drivers, which are part of the kernel.

Example: When you press a button on your phone, the kernel processes this input and passes it to the appropriate software layer to perform the required action.

2.      Hardware Abstraction Layer (HAL)

Definition: HAL is an interface that allows Android to communicate with hardware-specific components.

What: It provides a standard way to implement hardware drivers without modifying the higher-level system components.

Why: It allows different hardware implementations to work seamlessly with Android’s framework.

How: Hardware manufacturers create HAL modules specific to their devices, ensuring compatibility with the Android system.

Example: The camera HAL enables Android applications to interact with the device’s camera hardware, capturing photos and videos.

3.      Native Libraries

Definition: Native libraries are C/C++ libraries that provide low-level functionalities.

What: They support various features like graphics rendering, data storage, and web browsing.

Why: They enhance performance by providing optimized implementations of critical functions.

How: These libraries are invoked by the Android runtime and application framework to perform tasks efficiently.

Example: The OpenGL library allows Android applications to render 2D and 3D graphics smoothly.

4.      Android Runtime (ART)

Definition: ART is the runtime environment where Android applications execute.

What: It translates the app code into native machine code for the device.

Why: It improves performance and memory management compared to its predecessor, Dalvik.

How: ART uses ahead-of-time (AOT) compilation to convert bytecode into native code before the application runs.

Example: When you install an app, ART compiles it, ensuring faster and more efficient execution when you use it.

5.      System Services

Definition: Background processes providing essential functions to Android OS and apps.

What: They handle critical tasks like power management, network connectivity, and sensor data processing.

Why: It simplifies app development by offering reusable components and a standardized environment.

How: Maintains system stability, performance, and security, enabling robust app development.

Example: Notification Manager Service is responsible for managing notifications displayed to the user. It handles tasks such as displaying notifications in the status bar, managing notification channels, and handling user interactions with notifications.

6.      Android Framework:

Definition: The Android framework is a collection of Java classes, interfaces, and precompiled code upon which Android apps are built. 

What: It provides core functionalities and services used by apps.

How: Portions of the Android framework are publicly accessible through the Android API, while others are available only to OEMs through system APIs. Android framework code runs inside an app's process, facilitating interaction between the app and the underlying system.

Example: An email app that allows users to read, compose, and manage emails. This app relies on the Android framework for UI components (e.g., displaying emails in a list), data storage (e.g., saving email drafts). 

System API:

    The System API consists of Android APIs available only to partners and OEMs (Original Equipment Manufacturers) for inclusion in bundled applications. These APIs are marked as @SystemApi in the source code.

Android API:

    The Android API is the publicly available API for third-party Android app developers. It provides a set of classes, interfaces, and methods for building Android applications.

Android App:

     An Android app is a software application designed to run on Android devices. It is created using the Android API and typically downloaded and installed from the Google Play Store or other app stores.

Example: A weather app that displays current weather conditions and forecasts to users. This app utilizes the Android API to access location services for weather updates and the network for fetching weather data.

Privileged App:

     A privileged app is created using a combination of the Android and system APIs. These apps are preinstalled on a device and have elevated privileges compared to regular third-party apps.

Example: A system monitoring app that collects detailed information about device performance and hardware status. This app may need privileged access to system resources for accurate monitoring and analysis.

Device Manufacturer App:

    A device manufacturer app is created using a combination of the Android API, system API, and direct access to the Android framework implementation. These apps are preinstalled on devices by manufacturers and are tightly integrated with the device's hardware and software.

Example: A camera app developed by a smartphone manufacturer that offers advanced camera modes and settings optimized for the device's camera hardware. This app may directly access device-specific camera APIs for better performance and functionality.


Conclusion

Understanding the architecture of AOSP provides a solid foundation for anyone looking to develop, customize, or simply appreciate the intricacies of Android. It also helps in enabling a rich user experience as each layer plays a vital role in making Android the versatile and powerful platform it is today. By grasping these concepts, developers can create more efficient, innovative, and secure applications, contributing to the ever-growing Android ecosystem.

Comments

Popular posts from this blog

PROJECT GREPINFO

INTRODUCTION Project Name:  GrepInfo Purpose:   An automated framework for retrieving device specifications. Developed In Purpose:  Python Specification to be Collected: Hardware Specifications Software Specifications CPU Specifications Memory Specifications Display Specifications   ROOTED VS NON- ROOTED DEVICES Rooted Devices: Rooted devices are like super-powered phones that let you change almost anything you want. You can customize your phone to do things it couldn't do before, like making it faster or removing apps you don't need. Non-Rooted Devices: Non-rooted devices are like regular phones that stick to the rules set by the phone's maker. They're safer and more stable, but you can't tweak them as much as rooted phones.   T YPES OF DEVICES FOR RETRIEVING SPECS 1. Commercial Devices (Non-Rooted Devices): Description:  Standard smartphones ...

MobiSpec Analyzer

v Project :   I have been part of a project is called MobiSpec Analyzer. v Purpose : Its purpose is to extract detailed information about various phone properties using adb commands, compare the specs across multiple phones, and analyze which phone is superior in different aspects. The results were presented through summary reports in Excel and JSON formats. v Initial Approach : Initially, we extracted all the information manually by executing commands in the command-line interface. This included gathering data on CPU specs, hardware details, battery properties, and display specifications.  Phone properties were extracted manually using adb commands and grep in the command-line interface. Commands were executed individually to retrieve CPU specs, hardware details, battery properties, camera specifications and so on. Each property required separate commands, leading to repetitive execution for each device. Data outputs were stored in multiple files, one for each device, c...

MobiSpec Analyzer SDLC

The SDLC involves planning the project, gathering requirements, designing the system, coding the software, testing it for issues, deploying it to users, and maintaining it post-release. Each phase ensures the software meets user needs and functions correctly, from start to finish. Stage-1: Planning and Requirement Analysis Planning: Define the project goals: Automate the extraction of phone properties, enabling the comparison of multiple phone specs and determining the superior phone in various aspects, with results presented through summary reports in Excel and JSON formats. Identify stakeholders: Developers, end-users, and potential clients. Conduct feasibility study: Assess technical feasibility which involves evaluating if the project can effectively use available technology and resources. Economic feasibility assesses if the project's benefits justify the costs associated with developing and maintaining the automation framework. Risk analys...