You are previewing Embedded Android.

Embedded Android

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

Chapter 7. Android Framework

Ultimately, your goal is to get your embedded system to run the Android environment users and developers are accustomed to, not simply the native user-space we just covered. That includes not only the full set of system services and the packages that provide the standard APIs used by app developers, but also some less visible components, such as a set of native daemons that support the system services and the Hardware Abstraction Layer. This chapter will cover how the Android Framework operates on top of the native user-space and will discuss how to interact with and customize it.

Note that unlike the previously discussed components of Android, whose behavior can be modified in a number of ways, most of the Android Framework has to be used as is. You can’t, for instance, pick and choose which system services to run, as they aren’t started from a script or based on a configuration file. Instead, modifying the Framework typically requires diving into its sources and/or adding your own code to customize its behavior.

Such customization work therefore requires becoming intimately familiar with Android’s sources and is inherently version dependent. Still, we’ll try to cover enough of the essentials to enable you to start navigating Android’s internals on your own. Nevertheless, expect this to be the start of a long-term endeavor, as Android’s sources are fairly big, and new releases come out at a very rapid pace.

The best content for your career. Discover unlimited learning on demand for around $1/day.