Android System Programming
By Roger Ye
4.5/5
()
About this ebook
- Master Android system-level programming by integrating, customizing, and extending popular open source projects
- Use Android emulators to explore the true potential of your hardware
- Master key debugging techniques to create a hassle-free development environment
This book is for Android system programmers and developers who want to use Android and create indigenous projects with it. You should know the important points about the operating system and the C/C++ programming language.
Read more from Roger Ye
Android System Programming: Porting, customizing, and debugging Android HAL Rating: 0 out of 5 stars0 ratings
Related to Android System Programming
Related ebooks
Android Design Patterns and Best Practice Rating: 5 out of 5 stars5/5Gradle for Android Rating: 0 out of 5 stars0 ratingsLearning Android Game Development Rating: 0 out of 5 stars0 ratingsMastering Embedded Linux Programming - Second Edition Rating: 4 out of 5 stars4/5Learning Node.js for Mobile Application Development Rating: 0 out of 5 stars0 ratingsMastering Android Game Development Rating: 0 out of 5 stars0 ratingsAsynchronous Android Rating: 4 out of 5 stars4/5Application Development with Swift Rating: 0 out of 5 stars0 ratingsArduino Android Blueprints Rating: 0 out of 5 stars0 ratingsMastering Android NDK Rating: 0 out of 5 stars0 ratingsNode.js By Example Rating: 2 out of 5 stars2/5Mastering Android Application Development Rating: 5 out of 5 stars5/5Android Application Development Cookbook - Second Edition Rating: 5 out of 5 stars5/5Android Studio Cookbook Rating: 4 out of 5 stars4/5Android Studio Development Essentials Rating: 5 out of 5 stars5/5Android Programming for Beginners Rating: 3 out of 5 stars3/5Learning Java by Building Android Games Rating: 0 out of 5 stars0 ratingsLearning Embedded Android N Programming Rating: 0 out of 5 stars0 ratingsAndroid: Programming for Developers Rating: 0 out of 5 stars0 ratingsNode.js Web Development - Third Edition Rating: 2 out of 5 stars2/5Android NDK: Beginner's Guide - Second Edition Rating: 0 out of 5 stars0 ratingsAndroid Programming For Beginners: The Simple Guide to Learning Android Programming Fast! Rating: 0 out of 5 stars0 ratingsLearning PHP 7 High Performance Rating: 0 out of 5 stars0 ratingsMastering Embedded Linux Programming Rating: 5 out of 5 stars5/5Node.js Design Patterns - Second Edition Rating: 4 out of 5 stars4/5Yocto for Raspberry Pi Rating: 0 out of 5 stars0 ratingsLearning Android Application Development Rating: 0 out of 5 stars0 ratingsProgramming in C | Step by Step: The Simple Beginner's Guide Rating: 0 out of 5 stars0 ratingsMastering Swift 5 - Fifth Edition: Deep dive into the latest edition of the Swift programming language, 5th Edition Rating: 0 out of 5 stars0 ratings
Programming For You
Coding All-in-One For Dummies Rating: 4 out of 5 stars4/5SQL QuickStart Guide: The Simplified Beginner's Guide to Managing, Analyzing, and Manipulating Data With SQL Rating: 4 out of 5 stars4/5Python: Learn Python in 24 Hours Rating: 4 out of 5 stars4/5SQL All-in-One For Dummies Rating: 3 out of 5 stars3/5Excel : The Ultimate Comprehensive Step-By-Step Guide to the Basics of Excel Programming: 1 Rating: 5 out of 5 stars5/5Python Programming : How to Code Python Fast In Just 24 Hours With 7 Simple Steps Rating: 4 out of 5 stars4/5Learn PowerShell in a Month of Lunches, Fourth Edition: Covers Windows, Linux, and macOS Rating: 5 out of 5 stars5/5Learn to Code. Get a Job. The Ultimate Guide to Learning and Getting Hired as a Developer. Rating: 5 out of 5 stars5/5JavaScript All-in-One For Dummies Rating: 5 out of 5 stars5/5Grokking Algorithms: An illustrated guide for programmers and other curious people Rating: 4 out of 5 stars4/5PYTHON: Practical Python Programming For Beginners & Experts With Hands-on Project Rating: 5 out of 5 stars5/5HTML & CSS: Learn the Fundaments in 7 Days Rating: 4 out of 5 stars4/5The Most Concise Step-By-Step Guide To ChatGPT Ever Rating: 3 out of 5 stars3/5Linux: Learn in 24 Hours Rating: 5 out of 5 stars5/5Beginning Programming with C++ For Dummies Rating: 4 out of 5 stars4/5Excel 101: A Beginner's & Intermediate's Guide for Mastering the Quintessence of Microsoft Excel (2010-2019 & 365) in no time! Rating: 0 out of 5 stars0 ratingsPython QuickStart Guide: The Simplified Beginner's Guide to Python Programming Using Hands-On Projects and Real-World Applications Rating: 0 out of 5 stars0 ratingsHTML in 30 Pages Rating: 5 out of 5 stars5/5Mastering Excel: Starter Set Rating: 2 out of 5 stars2/5Coding with JavaScript For Dummies Rating: 0 out of 5 stars0 ratingsSpies, Lies, and Algorithms: The History and Future of American Intelligence Rating: 4 out of 5 stars4/5C Programming For Beginners: The Simple Guide to Learning C Programming Language Fast! Rating: 5 out of 5 stars5/5A Slackers Guide to Coding with Python: Ultimate Beginners Guide to Learning Python Quick Rating: 0 out of 5 stars0 ratings
Reviews for Android System Programming
2 ratings0 reviews
Book preview
Android System Programming - Roger Ye
Title Page
Android System Programming
Porting, customizing, and debugging Android HAL
Roger Ye
BIRMINGHAM - MUMBAI
Copyright
Android System Programming
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2017
Production reference: 1290517
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78712-536-0
www.packtpub.com
Credits
About the Author
Roger Ye has worked in the area of embedded system programming for more than 10 years. He has worked on system programming for mobile devices, home gateways, and telecommunication systems for various companies, such as Motorola, Emerson, and Intersil.
Most recently, he has worked as an engineering manager, leading a team of Android engineers to develop mobile security applications at Intel Security. With extensive knowledge and experience in the areas of embedded systems and mobile device development, he published a book called Embedded Programming with Android, Addison-Wesley, in 2015.
I would like to thank my dearest wife, Bo Quan, and my lovely daughter, Yuxin Ye, for enduring me to spend significant time on this book over the weekends. They have been very encouraging and always give me support to work on the things that I am interested in.
About the Reviewers
Bin Chen is a senior engineer from Linaro. He has worked on various Android-based products since 2010: TV, STB, Galaxy Tab, Nexus Player, and Google Project Ara, in that order, and now AOSP 96Boards. He occasionally blogs and speaks about all things Android. He lives in Sydney, Australia.
Chih-Wei Huang is a developer and promoter of free software who lives in Taiwan. He is famous for his work in the VoIP and internationalization and localization fields in Greater China.
Huang graduated from National Taiwan University (NTU) in 1993 with a bachelor's degree in physics, and attained a master's degree in the electrical engineering department of NTU in 2000. Huang currently works as a chief engineer of Tsinghua Tongfang Co., Ltd.
for the OPENTHOS project. He is one of the founding members of the Software Liberty Association of Taiwan (SLAT).
Chih-Wei Huang is the founder and coordinator of the Chinese Linux Documentation Project (CLDP). He is also the second coordinator of the Chinese Linux Extensions (CLE)
and a core developer of GNU Gatekeeper (from 2001 to 2003).
He is a contributor to pyDict, OpenH323, Asterisk, GStreamer, and more. He is working on a way to leverage the ASUS Eee PC with the power of the free software community and aims to provide a complete solution for Android on the x86 platform. The Eee PC, VirtualBox, and QEMU have been tested and are OK.
Chih-Wei Huang and Yi Sun started the Android-x86 open source project in 2009. The project aims to bring Android to the x86 platform.
About the Reviewers
Shen Liu is a senior engineer, working at Intel China. He used to work at McAfee LLC, Broadcom Corporation, and Huawei Technologies. He has over 10 years of work experience on Linux/Android and embedded systems, in different roles. He had taken manager, architect, and engineer roles during his career. He is mainly responsible for the Android framework, but is not limited to it, and he has a lot of passion for software design. On top of that, he loves reading technical books.
Nanik Tolaram works as a senior Android platform engineer for BlocksGlobal in Australia, where he is responsible for developing Screener (screener.digital) and Lumin (mylumin.org). He is passionate about Android and is very active within both the local and international Android developer communities--from talks and teaching to writing articles for ODROID open source magazine (magazine.odroid.com). In his spare time, he loves to tinker with electronics and study human psychology and behavior. He lives in Sydney, Australia, with his lovely wife and two beautiful boys.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.comand as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at www.amazon.com/dp/178712536X.
If you'd like to join our team of regular reviewers, you can e-mail us at [email protected]. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
Virtual hardware platforms
Android version used in this book
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
Introduction to Android System Programming
What is system programming?
What is the scope of this book?
Overview of the Android system
Kernel
HAL
Android system services
Binder IPC
Application framework
Recovery
The third-party open source projects derived from AOSP
LineageOS (CyanogenMod)
Android-x86
CWM/CMR/TWRP
Strategy of integration
Virtual hardware reference platforms
Introduction to the x86-based Android emulator
Introduction to ranchu
VirtualBox-based Android emulators
Summary
Setting Up the Development Environment
Summary of Android versions
Installing Android SDK and setting up an Android Virtual Device
Creating AVD in an older version of SDK
Creating AVD in the latest version of SDK
Testing the goldfish emulator
Testing ranchu emulator
The AOSP build environment and the Android emulator build
The AOSP build environment
Installing the required packages
Installing Open JDK 7 and 8
Downloading the AOSP source
Installing repo
Initializing a repo client and downloading the AOSP source tree
Building AOSP Android emulator images
Testing AOSP images
Creating your own repository mirror
Repo and manifest
Using a local mirror for AOSP
Creating your own mirror of GitHub
Fetching Git repositories outside GitHub
Creating your own manifest for client download
Summary
Discovering Kernel, HAL, and Virtual Hardware
What is inside the AOSP?
Android emulator HAL
Calling sequence
Goldfish lights HAL
The system service and hardware manager
Android emulator kernel and hardware
Android emulator hardware
Goldfish platform bus
QEMU pipe device
Goldfish audio device
Goldfish serial port
Goldfish kernel
QEMU pipe
Summary
Customizing the Android Emulator
Why customize the Android emulator
Understanding build layers
Build variants
Creating a new x86emu device
Checking out from the AOSP
Checking out from a local mirror
Creating x86emu device
AndroidProducts.mk
BoardConfig.mk
device.mk
Building and testing x86emu
Building x86emu
Testing x86emu
Integrating with Eclipse
Summary
Enabling the ARM Translator and Introducing Native Bridge
Introducing Native Bridge
Setting up Native Bridge as part of the ART initialization
Pre-initializing Native Bridge
Initializing Native Bridge
Loading a native library
Integrating Houdini to the x86emu device
Changing the configuration of the x86emu build
Extending the x86emu device
Changes to BoardConfig.mk
Changes to x86emu_x86.mk
Changes to device.mk
Using the Android-x86 implementation
Analyzing libnb.so
Using binfmt_misc
Building and testing
Testing the command-line application
Testing the Android JNI application
Summary
Debugging the Boot Up Process Using a Customized ramdisk
Analyzing the Android start up process
Bootloader and the kernel
Analyzing the init process and ramdisk
Actions
Services
Device-specific actions and services
Source code and manifest changes
The Android-x86 start up process
The first-stage boot using initrd.img
Inside initrd.img
Inside install.img
Building x86emu with initrd.img
Creating a filesystem image
Kernel changes
Booting a disk image on the Android emulator
Summary
Enabling Wi-Fi on the Android Emulator
Wi-Fi on Android
The Wi-Fi architecture
QEMU networking and wpa_supplicant in Android
Adding Wi-Fi to the emulator
Enabling wpa_supplicant in BoardConfig.mk
Providing a proper wpa_supplicant configuration
Creating services in init scripts
Initializing network interface eth1
Starting up wpa_supplicant
Building the source code
Getting the source code
Enabling boot with initrd.img
Testing Wi-Fi on an emulator
Booting an Android emulator using initrd.img
Booting an Android emulator using ramdisk.img
Debugging Wi-Fi start up processes
Summary
Creating Your Own Device on VirtualBox
HAL of x86vbox
The manifest for x86vbox
Creating a new x86vbox device
Product definition Makefile of x86vbox
Board configuration of x86vbox
Common x86 devices
Getting the source code and building the x86vbox device
Boot up process and device initialization
Device initialization before Android start-up
HAL initialization during the Android start-up
Summary
Booting Up x86vbox Using PXE/NFS
Setting up a PXE boot environment
Preparing PXE Boot ROM
Downloading and building the LAN Boot ROM
Fixing up the ROM image
Configuring the virtual machine to use the LAN Boot ROM
Setting up the PXE boot environment
Configuring and testing the PXE boot
Setting up the virtual machine
Using VirtualBox internal PXE booting with NAT
Configuring pxelinux.cfg
pxelinux.cfg/default
Setting up a serial port for debugging
NFS filesystem
Preparing the kernel
Setting up the NFS server
Configuring the PXE boot menu
Booting to NFS installation
Booting from a hard disk
Booting to recovery
Summary
Enabling Graphics
Introduction to the Android graphics architecture
Delving into graphics HAL
Loading the Gralloc module
Initializing GPU
Initializing framebuffer
Allocating and releasing the graphic buffer
Allocating from framebuffer
Allocating from system memory
Releasing graphic buffers
Rendering framebuffer
Graphics HAL of the Android emulator
Overview of hardware GLES emulation
Initializing GPU0 and FB0 in GLES emulation
GPU0 device implementation
FB0 device implementation
Summary
Enabling VirtualBox-Specific Hardware Interfaces
OpenGL ES and graphics hardware initialization
Loading OpenGL ES libraries
Analyzing the loading process
Loading the driver
Creating the rendering engine
The uvesafb framebuffer driver
What is uvesafb?
Testing the uvesafb framebuffer driver
Initializing uvesafb in x86vbox
Integrating VirtualBox Guest Additions
Building VirtualBox Guest Additions
Integrating vboxsf
Integrating vboxvideo
Building and testing images with VirtualBox Guest Additions
Summary
Introducing Recovery
Recovery introduction
Android device partitions
Analyzing recovery
BCB
Cache partition
Main flow of recovery
Retrieving arguments from BCB and cache files
Factory data reset
OTA update
Building recovery for x86vbox
Building configuration
Changes to x86vbox
Changes to recovery
Changes to newinstaller
Testing recovery
Summary
Creating OTA Packages
What is inside an OTA package
Updater
The updater script
Edify functions
Built-in functions
Installation functions
Block image functions
Device extensions
Preparing an OTA package for x86vbox
Removing dependencies on /system
Hardware initialization in recovery
Minimum execution environment in recovery
Building and testing
Summary
Customizing and Debugging Recovery
Debugging and testing native Android applications
Debugging with GDB
Integration with Eclipse
Extending recovery and the updater
Extending recovery
Extending the updater
Extending the Python module
Building and testing the extended recovery and updater
Supporting the third-party recovery packages
Xposed recovery package
Opening GApps
Summary
Preface
Android is the most popular mobile operating system in the world. Since 2013, Android has around 80% market share worldwide, while the second largest mobile operating system, iOS, has less than 20% market share. Due to the popularity of Android, there are many books about Android programming in the market. Most of them are targeted at Android application developers, which are the largest community in the world of Android development.
There is also another group of people working on the layer beneath the Android framework. Many people call them Android system developers. Comparing to Android application developers, Android system developers use the C/C++ languages, or even assembly language, to develop system services or device drivers. The scope and the definition of Android system development is much more vague than comparing to Android application development. For Android application development, the development environment and tools are very clear: the Android SDK and Android Studio from Google should be used and the programming language is Java.
For Android system development, we may use the Android NDK to develop Android system services or native applications. Many people refer to development based on the Android Open Source Project (AOSP) as Android system development. Nevertheless, Android system development encompasses the activities that produces native applications, services, or device drivers for a particular hardware platform. It closer to the hardware and the operating system, whereas Android application development is more general and hardware-independent.
Due to the hardware and operating system dependencies, it is more difficult to teach Android system programming than Android application programming. From the number of books in the market, we can see this. It is much easier to teach Android application development using specific examples. The readers of application programming books can follow the examples and can test them on most available Android devices. However, most Android system programming book can only talk about general concepts or ideas. When the authors want to use examples, they must pertain to a particular hardware platform and Android version. This makes it difficult for readers to repeat the same process.
Virtual hardware platforms
To make the discussion more general and overcome the issue of specific hardware platforms, I use virtual hardware platforms to demonstrate the work at the Android system level.
Before this book, I made an attempt to use a virtual hardware platform to explain how we can learn embedded system programming using an Android emulator in my previous book, Embedded Programming with Android. It seems many readers liked the idea, because they can explore the code examples much more easily on a virtual hardware platform that is available for everyone.
Android version used in this book
Android is still changing at a very fast pace. When I completed the book Embedded Programming with Android, we were still using Android 5 (Lollipop), and Android 6 (Marshmallow) was on the way to market with preview releases. Now while I am working on this book, Android 7 devices are available on the market and the next release of Android 8 has been announced with preview releases. We will use Android 7 (Nougat) to build all source code used in this book.
What this book covers
In this book, we discuss the Android system programming practices. We will use two projects (x86emu and x86vbox) to teach essential knowledge of Android system programming. The book is split into includes two parts.
The first part of this book talks about how to customize, extend, and port an Android system. We will use an Android emulator as the virtual hardware platform to demonstrate how to customize and extend an Android system. You will learn how to integrate an ARM translator (Houdini) into the Intel x86-based emulator and how to add Wi-Fi support to an Android emulator. We will use an x86emu device to learn these topics. After that, we will learn how to port an Android system to a new platform using VirtualBox. You will learn how to boot Android in the PXE/NFS environment, how to enable the graphics system, and how to integrate VirtualBox Guest Additions into the Android system. We will use x86vbox device to learn these topics.
In the second part of this book, we will learn how to update or patch a released system using recovery. In this part, we will provide a general introduction to recovery first. After that, we will explore how to build recovery for x86vbox device. With recovery for x86vbox device, we will demonstrate how to flash an update package to change the system image. We will use examples such as the Gapps and xposed recovery packages to demonstrate how to update an Android system image using third-party recovery packages.
Chapter 1, Introduction to Android System Programming, covers a general introduction of Android system programming. It also explains the scope of this book.
Chapter 2, Setting Up the Development Environment, provides details of the development environment setup for AOSP programming. After we set up the development environment, we will build an Android emulator image to test our setup. Other than the environment setup, we specifically discuss how to create your own source code mirror of AOSP from GitHub to help your quickly switch between different configurations.
Chapter 3, Discovering Kernel, HAL, and Virtual Hardware, covers an introduction to the Linux kernel, Hardware Abstraction Layer, and virtual hardware. In this chapter, we look at all the layers in the Android system software stack related to porting. We also take a in-depth look at the internals of the virtual hardware that we are going to use in this book.
Chapter 4, Customizing the Android Emulator, covers the development of a new device, x86emu. We will learn how to customize and extend this device in the next few chapters.
Chapter 5, Enabling the ARM Translator and Introducing Native Bridge, explores a new feature introduced in Android 5--Native Bridge. Since we created an x86-based device, x86emu, we have to integrate the ARM translator module (Houdini) into our device so that most ARM-native applications can run on it.
Chapter 6, Debugging the Boot Up Process Using a Customized ramdisk, introduces an advanced debugging skill to troubleshoot issues during the boot up stage. The famous Android-x86 project uses a special ramdisk to start the boot up process. It helps to troubleshoot device driver and init process issues very easily.
Chapter 7, Enabling Wi-Fi on the Android Emulator, presents details of how to enable Wi-Fi on our Android emulator. The Android emulator only supports an emulated 3G data connection, but many applications are aware of data and the Wi-Fi connection. We demonstrate how to enable Wi-Fi in the Android emulator in this chapter.
Chapter 8, Creating Your Own Device on VirtualBox, explores how to port Android on VirtualBox by introducing a new device x86vbox. The x86emu device is used to demonstrate how to customize an existing implementation, while x86vbox is used to demonstrate how to port Android to a new hardware platform.
Chapter 9, Booting Up x86vbox Using PXE/NFS, explains how to boot up Android on VirtualBox using PXE/NFS. Since VirtualBox is a general virtual hardware, the first problem that we meet is we need a bootloader to boot the system. We will use the PXE/NFS boot to solve this issue. This is an advanced debugging skills which can be used in your own project.
To discuss a more advanced case about the PXE/NFS setup using an external DHCP/TFTP server running in the host-only network environment, I have written an article, which you can find at https://www.packtpub.com/books/content/booting-android-system-using-pxenfs.
Chapter 10, Enabling Graphics, covers the Android graphic system. We introduce the Android graphics architecture and how to enable it on the x86vbox device.
Chapter 11, Enabling VirtualBox-Specific Hardware Interfaces, explains how to integrate the device drivers in VirtualBox Guest Additions into the Android system.
Chapter 12, Introducing Recovery, provides an introduction to recovery. We will learn how to customize and port recovery to a new hardware platform by building a recovery for the x86vbox device.
Chapter 13, Creating OTA Packages, covers the scripting language used by recovery: Edify. We will learn how to build and test OTA updates.
Chapter 14, Customizing and Debugging Recovery, expands on the concepts we learned about recovery and OTA packages. We will customize both recovery and updater for x86vbox device. We will test third-party OTA packages from Gapps and Xposed using our own recovery.
What you need for this book
To read this book, you should have essential knowledge of embedded operating systems and C/C++ programming language.
Who this book is for
Before we talk about who should read this book, we should ask who are the people that usually do Android system programming in the real world? There are potentially quite a lot. Here, I can give a few general categories. Firstly, there are a large number of engineers at Google working on the Android system itself, since Android is a product from Google. Google usually work with silicon vendors to enable Android on various hardware platforms.
There are many engineers at silicon chip companies, such as Qualcomm, MTK, or Intel to enable Android on their platform. They develop HAL layer components or device drivers to enable hardware platforms. The hardware platforms are usually called reference platforms, which are provided to OEM/ODM to build the actual products. Then, the engineers at OEM/ODM companies usually customize the reference platform hardware and software to add unique features to their products. All these engineers form the major groups working on system-level programming. Thus, if you are working in any of these areas, you may want to read this book.
Besides the previously mentioned categories, it is also possible that you are a developer working for an embedded system company. You may work on projects such as embedded system for automobile, video surveillance, or smart home. Many of these systems use Android nowadays. One of the fastest growing areas in embedded systems is Internet of Things (IoT) devices. Google announced Brillo as the operating system for IoT devices. Brillo is a simplified embedded operating system based on Android. The source code of Brillo is also included in the AOSP. This book is also relevant to people who use Brillo.
For Android application developers, system-level knowledge can help you to resolve complex issues as well. If you are working on projects that involve new hardware features, you may want to extend your knowledge to the system level.
This book is also useful for people teaching Android system programming or embedded system programming. There is plenty of source code in this book that can be used to form your own lesson plans.
Conventions
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: The general Android kernel source code is in the kernel/common folder , which looks very much like the Vanilla kernel.
A block of code is set as follows:
Any command-line input or output is written as follows:
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: We should set the launch type to Standard Create Process Launcher.
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Reader feedback
Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Customer support
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
Downloading the example code
You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
You can download the code files by following these steps:
Log in or register to our website using your e-mail address and password.
Hover the mouse pointer on the SUPPORT tab at the top.
Click on Code Downloads & Errata.
Enter the name of the book in the Search box.
Select the book for which you're looking to download the code files.
Choose from the drop-down menu where you purchased this book from.
Click on Code Download.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
WinRAR / 7-Zip for Windows
Zipeg / iZip / UnRarX for Mac
7-Zip / PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Android-System-Programming. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Errata
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at [email protected] with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
Questions
If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.
Introduction to Android System Programming
This book is about Android system programming. In this chapter, we will start with