Copyright
Table of Contents
Preface
Learning How to Embed Android
Audience for This Book
Organization of the Material
Software Versions
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
Chapter 1. Introduction
History
Features and Characteristics
Development Model
Differences From “Classic” Open Source Projects
Feature Inclusion, Roadmaps, and New Releases
Ecosystem
A Word on the Open Handset Alliance
Getting “Android”
Legal Framework
Code Licenses
Branding Use
Google’s Own Android Apps
Alternative App Markets
Oracle versus Google
Mobile Patent Warfare
Hardware and Compliance Requirements
Compliance Definition Document
Compliance Test Suite
Development Setup and Tools
Chapter 2. Internals Primer
App Developer’s View
Android Concepts
Framework Intro
App Development Tools
Native Development
Overall Architecture
Linux Kernel
Wakelocks
Low-Memory Killer
Binder
Anonymous Shared Memory (ashmem)
Alarm
Logger
Other Notable Androidisms
Hardware Support
The Linux Approach
Android’s General Approach
Loading and Interfacing Methods
Device Support Details
Native User-Space
Filesystem Layout
Libraries
Init
Toolbox
Daemons
Command-Line Utilities
Dalvik and Android’s Java
Java Native Interface (JNI)
System Services
Service Manager and Binder Interaction
Calling on Services
A Service Example: the Activity Manager
Stock AOSP Packages
System Startup
Chapter 3. AOSP Jump-Start
Development Host Setup
Getting the AOSP
Inside the AOSP
Build Basics
Build System Setup
Building Android
Running Android
Using the Android Debug Bridge (ADB)
Mastering the Emulator
Chapter 4. The Build System
Comparison with Other Build Systems
Architecture
Configuration
envsetup.sh
Function Definitions
Main Make Recipes
Cleaning
Module Build Templates
Output
Build Recipes
The Default droid Build
Seeing the Build Commands
Building the SDK for Linux and Mac OS
Building the SDK for Windows
Building the CTS
Building the NDK
Updating the API
Building a Single Module
Building Out of Tree
Building Recursively, In-Tree
Basic AOSP Hacks
Adding a Device
Adding an App
Adding an App Overlay
Adding a Native Tool or Daemon
Adding a Native Library
Chapter 5. Hardware Primer
Typical System Architecture
The Baseband Processor
Core Components
Real-World Interaction
Connectivity
Expansion, Development, and Debugging
What’s in a System-on-Chip (SoC)?
Memory Layout and Mapping
Development Setup
Evaluation Boards
Chapter 6. Native User-Space
Filesystem
The Root Directory
/system
/data
SD Card
The Build System and the Filesystem
adb
Theory of Operation
Main Flags, Parameters, and Environment Variables
Basic Local Commands
Device Connection and Status
Basic Remote Commands
Filesystem Commands
State-Altering Commands
Tunneling PPP
Android’s Command Line
The Shell Up to 2.3/Gingerbread
The Shell Since 4.0/Ice-Cream Sandwich
Toolbox
Core Native Utilities and Daemons
Extra Native Utilities and Daemons
Framework Utilities and Daemons
Init
Theory of Operation
Configuration Files
Global Properties
ueventd
Boot Logo
Chapter 7. Android Framework
Kick-Starting the Framework
Core Building Blocks
System Services
Boot Animation
Dex Optimization
Apps Startup
Utilities and Commands
General-Purpose Utilities
Service-Specific Utilities
Dalvik Utilities
Support Daemons
installd
vold
netd
rild
keystore
Other Support Daemons
Hardware Abstraction Layer
Appendix A. Legacy User-Space
Basics
Theory of Operation
Merging with the AOSP
Using the Combined Stacks
Caveats and Pending Issues
Moving Forward
Appendix B. Adding Support for New Hardware
The Basics
The System Service
The HAL and Its Extension
The HAL Module
Calling the System Service
Starting the System Service
Caveats and Recommendations
Appendix C. Customizing the Default Lists of Packages
Overall Dependencies
Assembling the Final PRODUCT_PACKAGES
Trimming Packages
Appendix D. Default init.rc Files
2.3/Gingerbread’s default init.rc
4.2/Jelly Bean’s Default init Files
init.rc
init.usb.rc
init.trace.rc
Appendix E. Resources
Websites and Communities
Google
SoC Vendors
Forks
Documentation and Forums
Embedded Linux Build Tools
Open Hardware Projects
Books
Conferences and Events
Index
About the Author