Android Platform Development Kit


Android source code is maintained in two code bases: the Android Linux kernel (kernel directory) and Android platform and applications (device directory). This document provides a high-level introduction to the source code organization and an overview of the major components of each primary directory.

Android Source

Linux Kernel

The Android Linux kernel includes enhancements to the Linux 2.6 kernel that provide additional drivers to support the Android platform, including:

  • Binder: an OpenBinder-based driver to facilitate inter-process communication (IPC) in the Android platform.
  • Android Power Management: a light weight power management driver built on top of standard Linux power management but optimized for embedded systems.
  • Low Memory Killer: Based on hints from the userspace, the low memory killer can kill off processes to free up memory as necessary. It is designed to provide more flexibility than the Out Of Memory (OOM) killer in the standard kernel.
  • Logger: A light weight logging device used to capture system, radio, logdata, etc.
  • USB Gadget: Uses the USB function framework.
  • Android/PMEM: The PMEM (physical memory) driver is used to provide contiguous physical memory regions to userspace libraries that interact with the digital signal processor (DSP) and other hardware that cannot cope with scatter-gather.
  • Android Alarm: A driver which provides timers that can wake the device up from sleep and a monotonic timebase that runs while the device is asleep.

Look for Android-specific enhancements in the following directories:

  • /drivers/android
  • /drivers/misc
  • /include/linux

Android Platform and Applications

The following list outlines the directory structure found within the device branch of Android source code:

  • apps : Core Android applications such as Phone, Camera, and Calendar.
  • boot : Reference Android bootloader and other boot-related source code.
  • commands : Common Android commands, the most important of which is the runtime command, which does much of the initialization of the system.
  • config : System-wide makefiles and linker scripts.
  • content : Standard Android ContentProvider modules.
  • dalvik : Android runtime Virtual Machine (VM).
  • data : Fonts, keymaps, sounds, timezone information, etc.
  • docs : Full set of Android documentation.
  • extlibs : Non-Android libraries. This directory is intended to host unmodified external code. None of the libraries included within this directory rely on Android headers or libraries.
  • ide : Tools for support of the IDE's used to write Android applications.
  • include : Android system headers for inclusion.
  • java : Android core APIs, as well as some external libraries.
  • libs : Android-specific C++ based libraries.
  • partner : Project-specific source code for various proprietary components.
  • prebuilt : Prebuilt tools, like the toolchains and emulator binary.
  • product : Device-specific configuration files. This directory will include a subdirectory for each new device.
  • samples : Sample applications.
  • servers : C++ based system servers.
  • system : Core of the embedded Linux platform at the heart of Android. These essential bits are required for basic booting, operation, and debugging.
  • tests : Platform and application test cases.
  • tools : Tools for building and debugging Android (of particular interest for porting are "adb" and "emulator").

Adding Source Code

You can develop Android applications with the same standard tools you use to develop any Java application. The Android core libraries provide the functionality needed to build rich mobile applications and the Android development tools are designed to simplify running, debugging, and testing your applications.

Add project-specific source code to the Android source tree under the partner directory in a directory specific to the application or service you are building. For example, all Google-specific applications would be placed under device/partner/google/. A Google search application would be placed under device/partner/google/apps/Search.

See Building Android for a new Mobile Device for detailed instructions.

v0.3 - 9 June 2008