Inside the Android OS is the first comprehensive guide and reference for developers who want to customize and integrate Android into their own embedded devices. Replete with code examples, it encourages you to create your own working code versions as you read -- whether for your own personal insight or for a workplace project in the fast-growing marketplace for non-phone Android devices.

G. Blake Meike responds to the real-world needs of embedded and IoT developers moving to Android, providing indispensable information without becoming obscure or too specialized. Meike teaches through a book-length project that covers everything developers need to know to create their own custom Android service. You’ll find approachable yet precise coverage of:

  • Why Android is becoming a pervasive embedded platform

  • Using Android’s four-tier architectural model in embedded devices

  • Setting up a build platform, downloading the AOSP source, and building an Android image

  • Walking through system startup on a running Android system

  • Running native services on embedded systems

  • Using Android’s Native Development Kit (NDK) and HAL to link interpreted Java with native C/C++ code

  • Taking a deep dive into the seminal Zygote application and its Dalvik interpreter

  • Quickly building Java system services

  • Working with Binder, Android’s heart and the root of its security and access control models

  • Establishing permissions and access control

  • Enabling apps to use the services you’ve created

  • Building SDKs that allow third-party developers to code for your device

  • And much more

If you’re a software professional who wants to construct or maintain a successful Android-based product, this is the book you’ve been searching for.

Table of Contents

  1. Cover Page
  2. About This eBook
  3. Halftitle Page
  4. Title Page
  5. Copyright Page
  6. Dedication Page
  7. Contents at a Glance
  8. Contents
  9. Preface
    1. Example Code
    2. Register Your Book
  10. Acknowledgments
  11. About the Authors
  12. 1. Why Android?
    1. Adopting Android
    2. AOSP and Google
    3. Other Choices
    4. Summary
  13. 2. Booting Acme
    1. Setting Up a Build Machine
    2. Downloading the Code
    3. Repo
    4. Forking the Source
    5. Repository Commit Pinning
    6. Example: Local Mirror of Forked Repositories
    7. Building an Image
    8. Device Tools
    9. Flashing the Device
    10. Summary
  14. 3. Getting Started
    1. Putting Android in Its Place
    2. The Android Service Model
    3. Exploring the Source
    4. Summary
  15. 4. The Kernel
    1. The Linux Kernel
    2. The Android Kernel
    3. Building a Kernel
    4. Summary
  16. 5. Platform Security
    1. Types of Security
    2. Verified Boot
    3. Operational Security
    4. User Protections
    5. Customizing Permissions
    6. Summary
  17. 6. System Startup: Installing and Booting the System
    1. The Boot Process
    2. Recovery
    3. Building a Daemon
    4. Creating the Acme Device
    5. Repo Again
    6. Starting the Daemon
    7. Summary
  18. 7. Android Startup: Dalvik and Zygote
    1. Dalvik
    2. ART
    3. Zygote
    4. Summary
    5. Citations
  19. 8. Getting to Android: The HAL
    1. Why a HAL?
    2. Is a HAL Necessary?
    3. Designing the HAL
    4. Building a HAL
    5. Summary
  20. 9. Getting to Java: The JNI
    1. Code Structure
    2. Using the Device
    3. Using the HAL
    4. Using the Java Native Interface
    5. Summary
  21. 10. Project Treble: Binderized HAL
    1. HIDL Architecture
    2. Hardware Interface Definition Language (HIDL)
    3. HIDL Services
    4. HIDL Clients
    5. Summary
  22. 11. Creating a Custom Binderized HAL
    1. Acme Custom HIDL
    2. Summary
  23. 12. Clients for a Custom Binderized HAL
    1. Native C++ Aproximity Client
    2. Java/Kotlin Aproximity Client
    3. Summary
  24. Index
  25. Code Snippets