Android is the most popular open source operating system (OS) globally and shows no signs of slowing down. Its presence across various products, from Android-based tablets and smartphones to smart home devices, is undeniable. These devices impact our lives and require a universal tool to make them a reality. Creating a universal Android ecosystem of mobile devices is no small feat. This is where the Android Open Source Project (AOSP) shines. This guide discusses the specifics of AOSP and how it benefits the Android developer community.
A quick introduction to AOSP
AOSP is the open source toolset developers and Android original equipment manufacturers (OEMs) use to create custom versions of Android. Regarding the major OS updates to Android each year, the AOSP source code is often released in stages as it matures before the final public version. While Google is in charge of the main code for AOSP, other developers and the community play a crucial role in AOSP’s success. They help Google identify and fix bugs in the code or contribute to new features that may be added in future versions of Android.
The AOSP code is a collaborative effort between Google, the dedicated team of third-party developers, and community members contributing to the Android-based OS project. AOSP also allows anyone with some technical background to create a custom version of Android efficiently. From there, they can tweak and customize it how they want to build their unique Android platform experience for personal or business reasons.
AOSP isn’t only for big smartphone manufacturers
Samsung, for example, uses the AOSP code to build its custom version of Android, known as One UI. The Amazon Fire line of tablets is also built on AOSP with their customized version of Android called Fire OS. Fire OS almost doesn’t resemble Android. However, it’s built on the same AOSP source code as other customized versions of Android. Other popular Android device makers that use the AOSP code include Xiaomi, OnePlus, and Huawei, which relied on it for most of its existence as an Android smartphone manufacturer.
AOSP is also popular with Android custom ROM and custom kernel developers since they can make changes or additions to better meet their needs. For example, some custom ROM developers want to create features unique to them that are not found in AOSP. Others pick their favorite features from various custom ROMs and combine them into their fully-featured Android-based OS.
AOSP can be used by anyone to build a custom version of Android. Everyone has access to the same set of tools as the big companies.
How can you get started using AOSP?
To build a custom Android operating system with AOSP development tools, you must meet the hardware requirements and install the source code tools using a repo client. Unlike other online repo websites for developers like GitHub, AOSP uses Git and Repo. Both tools are specific to AOSP. The repos are stored collectively in Git and can only viewed correctly using the dedicated AOSP repo tool. This allows you to manage the different open source code branches for Android. After setting up Git and Repo, download the AOSP SDK to your computer.
The official AOSP documentation recommends downloading and developing on Linux-based operating systems such as Ubuntu. Since Android is a Linux-based mobile operating system, this makes sense if you want the highest level of Android compatibility. AOSP is designed for advanced users, so being comfortable with Linux is necessary to get the best coding environment. However, you can use Windows to an extent, but your experience will vary and may be missing core features. Regarding macOS, Android OS development is no longer supported for modern versions beyond Android 11.
How does AOSP work at a hardware level on Android?
Before you can understand the inner workings of an Android device, you need to know how AOSP works and interacts with the hardware. AOSP is made of multiple layers: the Linux kernel, hardware abstraction layer, Android framework, and applications. The section below breaks down these layers to understand how they work regarding AOSP.
The Linux kernel plays a big role in device management
The Android OS runs on a derivative of the Linux kernel, which acts as a low-level bridge between the device’s hardware and software. The kernel is responsible for various tasks across a device, including resource management for the CPU, the allocation of system RAM, and the communication of the internal storage device for installed apps. It’s also crucial for driver management for various on-device hardware, such as network interfaces, camera modules, and other sensors.
The kernel is used for power management settings and controls dedicated hardware security features. It also manages the multiple system services or apps constantly running in the background. The kernel controls device functions and allows hardware and software to communicate in synchronicity.
Hardware abstraction is crucial for device communication
The hardware extraction layer (HAL) allows the Android OS and on-device hardware to communicate at a system level. The kernel controls the drivers for specific on-device hardware and features. The HAL allows direct communication to the hardware via user interaction from the Android framework. The kernel and the HAL share a few similarities, but both processes work independently. The HAL uses device drivers and commands from the Android framework and communicates that with the kernel to define specific hardware features and functionalities.
The HAL is the meeting point that allows the software or app to interact directly with the hardware. For example, the camera app on your Android phone lets you interact with its features using a touch-friendly interface. The HAL allows the core camera hardware to communicate with the Android framework in the background. It does this in a way that doesn’t matter which camera module is being used. It knows it is requesting a camera feature. The Android framework and specific device drivers can define additional unique features of the camera.
The Android framework brings everything together
This layer is where the Android OS comes into play and how user requests within an app are sent to the HAL. The Android framework is the bridge that indirectly communicates on-screen interactions to the HAL. Using the Android Runtime (ART), the code from an app translates a request into a set of instructions that the device’s processor architecture understands. This information is sent to the Android framework, where the HAL interprets the request. Without ART, the commands or actions by a user from an Android app can’t interact with the HAL.
ART translates the initial Android app code into executable commands. The Android framework converts that so the HAL understands it. You can visually interact with hardware features using on-screen actions in an app, thanks to ART and the Android framework. The Android framework also defines how core services of Android apps interact with the system, including on-screen notifications or allocating resources for a particular app. ART, the Android framework, and the HAL must work together to make apps run properly on Android.
The entire process starts with Android apps
You must interact with an Android app before anything can happen with the ART, Android framework, or the HAL. When you tap the screen, the ART code sends that request to the Android framework, and then it goes to the HAL. From there, the HAL communicates with the hardware device drivers to translate that user interaction so that the kernel can understand it. When it reaches the kernel, the requested action is returned to the app in reverse order. This chain allows for a smooth transition and flow of information from the hardware to an app.
Does AOSP rely on Google Mobile Services to function?
Google Mobile Services (GMS) is the bundled package of core Google apps, services, and application programming interfaces (APIs) that are preinstalled with an Android device. GMS is a separate entity from AOSP and is not required when building a version of Android using the AOSP code base. Some examples of GMS apps include the Google Play Store, Google Maps, YouTube, Gmail, Drive, and other Google-based apps. If an Android device manufacturer, such as Samsung, wants to include the Google Play Store on their Galaxy smartphones, they must have proper GMS certification from Google.
Android device manufacturers use the compatibility test suite (CTS), which is a free toolset that gives them more insight into their devices. CTS allows them to verify that their devices are compatible with the Android platform and meet the GMS standards. CTS is easy to use and an integral part of their workflow as they build new Android devices. There’s also an option for device makers to send the test results from CTS to Google for validation, making the process more straightforward.
Are there any GMS alternatives for custom ROM developers?
Privacy-focused AOSP custom ROM developers typically choose not to include GMS by default, giving their customers the ability to opt out of GMS. Instead of using the Google Play Store for apps, their users often look to trusted open source software and various app stores as an alternative means of managing apps. Without GMS installed on an Android device, you can’t access the core Google apps and services. Some of your third-party apps might also be missing features. Many require GMS for various functions in the background.
If you want to use GMS on a privacy-focused custom ROM, install a custom implementation of GMS. For example, microG is a popular free and open source GMS alternative that offers many of the same features as GMS. MicroG is designed to replicate GMS but focuses on privacy and security by removing background and tracking services. As a bonus, the third-party apps that require GMS for certain features should work again. However, not all apps respond as expected when substituting GMS functionality with microG, so some uncertainty may exist.
AOSP has uses beyond smartphones and tablets
AOSP isn’t only for Android smartphones and tablets. It can be used on smart TVs, wearables, and other devices. For example, Internet of Things (IoT) products might rely on AOSP to an extent for certain core features or functionality. Such devices include smart speakers, security cameras, and other smart home products. Although WearOS, like on the Google Pixel Watch 2, is not entirely open source like Android, it shares some aspects of the AOSP code. The same can be said about the Chromecast with Google TV.
The many benefits of AOSP
Now that you better understand what AOSP is and its layers, let’s go over why it is a valuable tool in the Android development community. In the section below, we highlight the reasons for using AOSP to create custom versions of Android.
- Developers don’t need to create an OS. Not every developer has the means to design an OS from scratch. Relying on AOSP allows them to focus on developing a better user experience using Android.
- App development costs are much lower. Creating an app or OS from the ground up is costly and requires significant dedication. Relying on AOSP eliminates this aspect during the development phase.
- Android OS update turnarounds are faster. The source code for each new yearly version of Android is published online, so device manufacturers and other developers can push updates more efficiently. They can port the code from their previous version of Android right away and update their OS in record time, resulting in shorter wait times for device updates.
- Access to the new features added to Android’s base code. As with every yearly Android release, Google builds in new features by default as part of the original code. Any features added to the latest version of Android can be brought into a custom version of Android.
- The ability to entirely customize and tweak Android. One of the biggest appeals of Android is its ability to use it the way you want, and it’s no different regarding AOSP. Developers can build custom versions of Android using AOSP with as many or as few features from the original source code as they want. They can then add features to make them unique to their needs.
- The open source nature allows for more transparency. Since AOSP and the core Android OS are open source, anyone can comb through the source code to look for abnormalities. This cuts back on the idea that someone can develop a custom version of Android for malicious reasons.
AOSP makes the openness of Android possible
Android is thriving today across the globe, likely because developers and device manufacturers have direct access to the Android source code. AOSP helps them build, customize, and develop their versions of Android, giving them everything they need without designing an OS. By tapping into the tools provided by AOSP, they can focus on their needs and develop features for their customers or the general market. Without AOSP, the dedicated developer community, and device manufacturers, Android wouldn’t be as widely adopted as it is now.
Now that you know more about AOSP, you might be interested in learning how to install Android apps on multiple devices simultaneously. We cover everything you need to know to help you effortlessly automate your app installs.