Android Internals 101 : AOSP Directory Structure

Faraz Sheikh
4 min readAug 5, 2024

--

Hello Droids! Welcome back to the ongoing series of Android Internals 101 with me. Today’s blog is quite interesting though, which actually will help us to traverse on the AOSP folder structure.
By the end of these blog we will make sure to have all the essential info about the AOSP directory structure thoroughly.

It’s time to dive in blue again …

BugDroid Ocean Blue by itsfrz
Photo by Faraz Sheikh / itsfrz

Here is layer wise directory structure of AOSP :

AOSP Directories By Layer
Photo by Faraz Sheikh / itsfrz

In the above image we can clearly see how directory structure looks layer wise. But still the big picture remains unclear. Now to understand that deeply, we will try to understand the functionality of every folder to get hold on actual structure.

Android Source Code Directory (Concept) :

  • art : Android runtime environment. All the ART related modules can be found here including dex compiler, JVM, dalvikVM, etc.
  • bionic : Amdroid’s custom C library. Bionic is android’s C library, math library and dynamic linker.
  • bootable : Boot related code. Contains bootloader, OTA, recovery mechanism.
  • build : Build system. You can find envsetup.sh, common shell scripts and make, soong folder here.
  • compatibility : CDD (Compatibility Definition Document).
  • cts : CTS is Android’s (Compatibility Test Suite Standard).
  • dalvik : Dalvik virtual machine related code, even though art was introduced. Android still used the dex code. In this folder, there are modules supporting dex code generator and Dalvik exchange.
  • developers : Developers directory contains demo and sample android projects.
  • development : Application development related. here you can find the development IDE like clion, eclipse, intellij under the ide folder. Lots of sample implementation under samples folder. And many other folders as well.
  • device : Device specific files and components. Here we can find the supporting config and driver files required for development boards like linaro hikey, ti, amlogic, etc.
  • external : External open source project imported into the AOSP. This folder contains a lot of dependent projects used by AOSP like Dagger2, exoplayer, flatbuffers, icu, jackson, rust and many other. There are around 347 dependent modules in it as in AOSP 12.
  • frameworks : Application framework. The code part of the android system written in Java and C++. Here we can find all the system services and core implementations of android.
    As mentioned, It is the place where most API’s are defined.
    /frameworks/base/core/java/android/app
    /frameworks/base/core/java/android/content
    /frameworks/base/services/core/java
    contains most system services, and these directories typically have more granularity than /core/java/ Since they can be refactored without top layer API changes.
  • hardware : Mainly the code of the hardware abstraction layre and hardware support modules, consist of HAL for audio, video, usb, tv, camera, etc.
  • kernel : Contains kernel configs, prebuilts.
  • libcore : Consist of many core libraries related json, xmlparser, apache harmony, etc.
  • libnative helper : Dynamic library. the basis of JNI library. It consist of helper functions to use with JNI.
  • ndk : NDK (Native Development Kit) related code to help developers to ember C/C++ code in the android application.
  • out : After the build completes, the code output is in this directory. You can find the generated images for the build here.
  • packages : Application package like stock android apps, providers, IMF’s and many more.
  • pdk : Platform development kit. PDK is a reduced set of android release provided to chipset vendors and OEM’s before a new android platform is released.
    The goal of the PDK release is to help chipset vendors and OEM’s to migrate to a new release.
    PDK release includes only necessary components for developing android HAL (Hardware Abstraction Layer). Note full android release is a superset of PDK release.
  • platform_testing : Platform test, consist of platform test modules.
  • prebuilts : Consist of prebuilt binaries. Includes toolchains like asuite, android emulator, bazel, etc.
  • sdk : Many SDK tools sources can be found here. Instructions to build sdk for a specific build can be found here under docs.
  • system : It contains low level file system libraries, application and components. This is the “Embedded Linux” folder. Here you can find folders for SELinux, Logging, Libhidl and many low level configurations.
  • test : Contains the test suites like csuite, catbox, vts (vendor test suite), mts (mainline test suite), etc.
  • toolchain : Toolchain files related to benchmark and pgoprofiles.
  • tools : Tools files like apksig, asuite, trade federation, etc.

These are the complete folder structure of AOSP source code directory.

Android Source Code Directory (Practical) :

To make your learning interesting or rememberable, It is highly recommended to visit Android Directory HandsOn site. For a complete practical handsOn on AOSP directories.

Important AOSP Directories :

Below image depicts some of the most important AOSP directories you should go through first.

Important AOSP Directories
Photo by Faraz Sheikh / itsfrz

In the next article we’ll see such interesting topics of android internal’s, stay tuned. If you like please share with your friends, Please write your feedback for further improvements. Happy learning.

Let me know your experience about reading of this blog on my email.

--

--

Faraz Sheikh
Faraz Sheikh

Written by Faraz Sheikh

Mobile | Web | AI | Opensource | Leadership | Pen | More on : https://farazsheikh.web.app/

No responses yet