Android Internals Training Course

Course Summary

The Android Internals training course is designed for those who are already familiar with basics of the Android SDK and are looking to customize and/or extend the functionality of the platform.

Android Internals focuses on the Android NDK, and Android IDL APIs, to give you a clean access to underlying hardware and services, with future compatibility in mind. You will learn how to build custom images and hack the platform.

 

Duration [top]

Objectives [top]

By completing Android Internals training course you will be able to:

  • Explain the anatomy of the Android platform and get is physiology (layer interactions)
  • Build native applications in Android using JNI and NDK
  • Take advantage of Android AIDL to build IPC-enabled bound services
  • Build the entire Android platform from source and get what's what
  • Customize and extend the Android platform to build custom ROMs
  • Modify and extend Android frameworks and services
  • Take advantage of custom hardware with Android
  • Understand where Android departs from standard Linux

Audience [top]

This Android Internals course is for developers who want to dig deeper than the standard Android SDK. It is for those who want to hack the system a bit in order to add system services and hardware support for non-standard components or port Android to completely new boards.

Prerequisites [top]

Java

To take this course, you must know Java. You should be able to answer most of the following questions:

  • What is a difference between a class and an object?
  • What is the difference between static and non-static field?
  • What is the difference between extends and implements keywords?
  • What is an anonymous inner class?
  • What is the purpose of @Override?

To refresh your Java skills you can review our NewCircle Java Tutorial.

Additionally, knowledge of Eclipse is required. You could watch this 30-minute Eclipse tutorial to get up to speed.

C/C++/Make

To get the most benefit out of this class you must have a basic understanding of C and C++. For example, you should be able to answer the following:

  • What is a header file?
  • What is gcc and how to use it?
  • Basic usage of sprintf()
  • What is make and how does it work?
  • Be able to read and understand basic Makefiles
  • Be able to read and understand shell scripts

Linux

You should be familiar with basic Linux operating system. For example, you should be able to answer most of the following:

  • How do you use use the following commands: ls, ps, cp, mv, pwd, cat, chmod, chown, mount, and similar.
  • What is the init process?
  • What are users and groups in Linux and how do r/w/x permissions work?

Instructors [top]

Photo

Dave Smith has spent the last decade working as an engineer and software developer in the embedded and mobile space from his hometown of Denver, CO.  He is a lead team member at Double Encore, developing custom solutions.

Android Recipes by Apress Since 2009, Dave has worked as a consultant developing software at all levels of the Android platform; from writing user applications using the SDK to building and customizing the Android source code for embedded devices. Prior to that, he was an embedded applications developer and hardware systems integrator for the M2M industry, working mostly with 8 and 16-bit microprocessors. His favorite mobile projects are those that integrate custom accessory hardware with consumer devices or involve building Android for embedded platforms. Today he specializes primarily in integrating custom device interfaces, such as USB and UART, with application layer services on embedded Android hardware.

Dave is also passionate about providing resources for developers that they can make use of long term.  He frequently shares ideas via his development blog and Twitter (@devunwired).  He is the lead author of the popular Android book Android Recipes: A Problem Solution Approach published by Apress; a cookbook style text dedicated to getting Android developers up and running quickly by providing real-world useful examples of how to use the Android SDK and NDK to build applications quickly and well.  Dave is a regular speaker at Android conferences, such as AnDevCon, where he usually speaks on topics related to hardware integration. He also often writes guest columns for the software development magazine SD Times, where he shares thoughts and opinions on mobile development.  

Dave received his degrees in Electrical Engineering and Computer Science from the Colorado School of Mines, and is a licensed Professional Engineer.

More about Dave Smith...
Photo

Gil Zhaiek joined the NewCircle team from Vancouver, Canada and provides his expertise in the Android framework and the Linux kernel. He has 13 years of software and hardware experience that is critical for the field of board bring-ups. He started as a C++ coder of an online financial calculator, switched to FPGA and digital board design for a couple of years, and later integrated his knowledge in designing C++ Testbenches as a consultant to various hardware teams in more than 20 companies.

Having experience in nearly all the hardware and software components, he was able to transition smoothly to Real Time OS with Embedded Linux where he wrote drivers and was able to debug the hardware independently. A few years ago, Gil and his wife moved to Vancouver where he joined Recon Instruments as the Senior Embedded Android Engineer and later the Embedded Software Manager responsible for board bring-ups and Android framework customization.

Some of Gil's notable products he worked on include the MOD Live which was the first Ski Smart Head-Mounted-Display and the Recon Jet - a light sports HMD.

Gil earned his B.Sc in Mathematics and Computer Science from the University of Arizona. He also holds an MBA from Heriot-Watt University.

More about Gil Zhaiek...
Photo

Justin is a driven, entrepreneurial, serial CTO with 35 years in the business of video games, developing and delivering titles on 26 platforms. He is creator/co-creator of dozens of land-based casino and social casual casino games, successfully developing a number of F2P and real-money gaming related properties.

He has worked on such franchises as Civilization, Pitfall, Hotwheels, Tyco, Star Wars, Shrek and Battletanx and with Disney, eBay, Microsoft, Apple, Lucasarts, Activision, Mattel, Vivendi Universal and SONY as clients. Justin has extensive experience with consumer facing commercial software, large-scale websites and other types of digital and physical products.

More about Justin Lloyd...
Photo

Larry has spent over 16 years leading teams, designing and developing software and embedded systems for multiple markets. His ability to understand complete systems and the software stack has lead to high quality and high performance designs. In addition to developing device drivers, platform software and applications, Larry has developed and presented training for internal teams, end customers and technical conferences on highly technical content. Larry is currently the CTO and co-founder of HiQES, a engineering services company.

Five years ago, Larry was tasked with leading a new team to do Android platform software development, so he has experience diving headlong into new technology. Larry spearheaded internal ramp-up of developers, developing Android kernel drivers and middleware, and native code starting with the first public releases of Android. In fact, Larry was developing native C/C++ services and apps for Android before the first release of the Android NDK! Since that time, Larry has been the lead developer on three different new Android platforms, multiple Android platform extensions and applications.

More about Larry Schiefer...
Photo

Marius Mailat has been developing commercial software since 2000. His focus is mobile applications architecture and development for Android, QNX and iOS. 

He is an experienced Java developer who spent the majority of his career building large-scale Java applications for Xerox and Sabre Travel Network in Germany.

Android projects in which he has been involved are banking interfaces and shopping tools for Android. His interest in the secrets of Android platform was geared towards building Defense Squad Mobile Security app, a free, simple to use and innovative Android security solution. Marius is the founder of the Romanian Android Community Androider.ro which has now around 5000 active members.

More about Marius Mailat...

Outline [top]

Android Overview Module   (1 hour)

This module introduces you to the Android operating system to ensure a basic familiarity with the Android architecture, background, and terminology. You also learn additional sources of information for modifying the Android OS, porting it to new hardware, and complying with Google's Android compatibility requirements.

  • Overview of the Android platform architecture
  • Introduction to the structure and lifecycle of Android applications
  • Internet resources for Android platform developers
  • Android compatibility requirements: the Compatibility Definition Document (CDD) and Compatibility Test Suite (CTS)

Android Stack Module   (1 day)

The Android OS is categorized into four layers. From the bottom up they are the kernel layer, the user-space native layer, the application framework layer, and the applications layer. In this module you explore each of the layers in depth to understand their role and the components they contain.

Android Kernel Layer   (3 hours)

In this module you learn how Google has extended the standard Linux kernel for Android and how the upper layers of the Android OS interact with these extensions.

  • Where to find the source for Android's custom kernel
  • Binder: Android's primary inter-process communication (IPC) mechanism
  • Anonymous shared memory (ashmem): Android's replacement for POSIX SHM
  • Android's physical memory allocator, ION
  • Android power management extensions: wakelocks, early suspend, and alarms
  • Android's low-memory process killer
  • The Android logging system
  • Android's user and group management and kernel security enforcement (the "paranoid network security" kernel option)

Android Native Layer   (2 hours)

In this module you explore the portion of Android user-space that is implemented in native C/C++ code. You learn: in what ways Android's libc implementation, Bionic, is not POSIX-compliant (and why); how Android's user-space Hardware Abstraction Layer (HAL) defines a standard API for exposing hardware to the rest of the Android OS; what significant libraries, frameworks, and daemons are incorporated in Android; and how Android's Dalvik Virtual Machine (VM) enables both application and platform developers to write Android code in Java.

  • Bionic: Android's implementation of libc and how it differs from the BSD libc
  • User-space Hardware Abstraction Layer (HAL): standard APIs for accessing hardware
  • Overview of standard Android native daemons (e.g., adbd, rild, ueventd, etc.) and their purpose
  • Overview of other Android function libraries and frameworks
  • The Dalvik Virtual Machine (VM) and how it differs from a Java VM

Android Application Framework Layer   (1 hour)

Android's application framework layer not only exposes a Java API for application developers, but also implements much of the Android operating system in Java. In this module, you discover how Java-based system services manage the operating system, applications, and device hardware. You also learn the general model by which client-side manager classes interact with these system services through Binder IPC to access system features.

  • System service architecture
  • Significant system services and their roles (e.g., ActivityManagerService, PackageManagerService, ConnectivityManagerService, etc.)

Android Applications Layer   (1 hour)

This module describes the basic structure of an Android application and how it is distributed as an Android application package (APK). It also identifies the standard set of Android system applications and where they are implemented in the source distribution.

  • Android application structure
  • Standard Android system applications, wallpapers, and input method editors

Java Native Interface (JNI) and the Android Native Development Kit (NDK)   (4 hours)

Much of the Android platform is implemented in Java, and yet that code needs to access functionality written in C/C++ and compiled to native machine code. Additionally, an application developer may want to implement portions of an app in C/C++ for performance or to incorporate existing native libraries and frameworks.

Java Native Interface (JNI) is a standard Java technology for integrating Java and native code. In this module, you learn the fundamentals of JNI and how to use it as a bridge between the native and Java-based runtimes. You also learn how to use Android's Native Development Kit (NDK) to implement portions of an application in native code and distribute it for use on multiple machine architectures.

  • JNI development process overview
  • Implementing Java methods in native code
  • Mapping Java types to native types
  • Managing object references in native code
  • Managing Strings, arrays, and other Java object types in native code
  • Throwing and catching exceptions in native code
  • Using NDK to incorporate native code in an app
  • Supporting multiple machine architectures with NDK
  • NDK "stable" APIs
  • Lab: NDK

Android Inter-Process Communication (IPC) with Binder and AIDL   (4 hours)

Binder is Android's primary inter-process communication mechanism. (In fact, most standard POSIX IPC mechanisms are not available for use in Android.) Even higher-level Android IPC techniques, such as broadcast Intents and interactions between system services and client-side manager classes, use Binder as the underlying transport mechanism.

In this module, you learn: the capabilities of Binder; how to generated Binder-based interfaces in Java using Android Interface Definition Language (AIDL); how Binder is used by client-side manager classes to communication with system services; and how applications can expose their own Binder-based interfaces to other applications.

  • Overview of Binder and its capabilities
  • Higher-level Android IPC mechanisms based on Binder
  • Binder communication and service discovery
  • Generating Binder-based service interfaces in Java using Android Interface Definition Language (AIDL)
  • Creating custom Parcelable Java types for use with Binder
  • Exposing a Binder-based interface from an application
  • Asynchronous Binder interactions
  • Binder limitations
  • Binder security
  • Detecting and handling Binder "death notifications"
  • Lab: Binder-based application service

Android Security Essentials   (3 hours)

Android extends standard Linux security to control access to device features like network interfaces, cameras, and stored personal information. In this module you learn how Android's permission model interacts with standard Linux security and how to define and enforce custom permissions to restrict access to system extensions.

  • User and group ID management
  • Android permission enforcement
  • Declaring custom Android permissions
  • Lab: Custom permissions
  • Securing application components using permissions

Building Android from Source   (2 hours)

In this module you learn how to set up an Android build system, download the Android source, build Android system images, and run them on emulators and real hardware.

  • Setting up an Android build system
  • Obtaining the Android source tree
  • Selecting the target product and build variant
  • Building Android system images from source
  • Running custom Android images on emulators and real hardware

Android Startup   (2 hours)

This module describes Android system startup including bootloading the kernel, launching standard Linux daemons, and initializing a variety of Binder-based system services. It also explains the importance of the Zygote daemon for reducing Android application startup time and memory consumption. Additionally, you learn how to customize the system boot process through custom init scripts.

  • Bootloading the kernel
  • The init process and Android's init scripting language
  • The standard boot process and how to customize it
  • The purpose of the Zygote daemon
  • Startup of system services

Android Subsystems   (3 hours)

This module presents an architectural overview of several of the most significant Binder-based system services in Android, explores interactions between services and client processes and between the various Android platform layers, identifies key source files in the implementation of the services, and provides references to additional resources for subject matter experts to extend and modify many services.

  • Vibrator
  • Power Service
  • Alarm Service
  • Package Service
  • WiFi Service
  • Location Service
  • Android Media Framework
  • Telephony
  • Device Policy Service
  • SurfaceFlinger
  • Camera Service
  • NFC Service

Creating a Customized Android System Image   (1 day)

This module integrates concepts from the entire course in the hands-on creation of a custom Android system image. You learn how to implement customizations at all Android stack levels, including custom kernels, HAL user-space libraries, executables, daemons, Java libraries, system applications, and Binder-based system services. Additionally, you'll learn how to support third-party developers for your Android devices by creating an SDK add-on that exposes your custom Java APIs and provides developers with a custom image they can use to create Android Virtual Devices (AVDs) on which they can run and test their code.

  • Setting up a custom device directory structure
  • Registering a custom device with Android‚Äôs build system
  • Adding the Makefile plumbing for a device
  • Generating platform signing keys (Optional)
  • Adding a custom kernel
  • Adding a custom native library and executable
  • Adding a custom daemon
  • Creating a custom Java library to expose a native library (i.e., JNI in the platform)
  • Consuming a custom Java/JNI library via a custom application (Optional)
  • Implementing a custom Binder-based system service
  • Building a custom application using a custom client-side manager class
  • Creating and distributing a custom SDK add-on to support third-party developers (Optional)

Android Tools and Debugging   (2 hours)

In additional to standard utilities for monitoring and troubleshooting Linux-based systems, Android includes several custom tools of its own. This module shows you how to use these tools to monitor and troubleshoot the Android kernel, processes, system services, and applications.

  • Debugging native code on Android
  • Debugging Java code on Android
  • Debugging applications and system services

Additional Notes [top]

Trademark Notice

Android is a trademark of Google Inc. Use of this trademark is subject to Google Permissions.


Student Testimonials [top]

Aleksandra did an excellent job though overall and was able to adjust the material well to our queries.

Ted - Intermec

This course was actually better than a previous course I had done at a university extension in terms of instructor knowledge and overall content. Also, since it was tailored and relevant to the company, it was great.

Mandar - Qualcomm, Inc.

Marko is extremely knowledgeable. Excellent class! Fantastic jump start into Android development!

Robert - Texas Instruments, Inc

The instructor did a great job of imparting complex information at a rapid clip. Hands-on activities were challenging and interesting.

Clara - Gracenote

Great training class.

Akos - The IMS Company

Great training! The training really knows Android Internals. Android Application lifecycle, startup and filesystem was explain really well.

Cesar - Texas Instruments

Great class. Tailored content to fit participants needs. Marko answered questions related to specific use-cases, and if didn't know the answer, then showed us how to find answer via lab experiment. Thank you!

Paul - Cisco

Marko is very knowledgeable and explains the entire Android System clearly and effectively. The training is going to help us tremendously!

Joshua - The IMS Company

Quite a lot gets covered in 2 days. Will give any one a quick start. Thank you, enjoyed it.

Nanda - Dreamer Corporation

I think Marko is a skilled trainer, excellent class driving with excellent background, Marko rocks!

Alfredo - TI

Provided a good understanding of the interaction between fundamental pieces of Android framework.

Gokul - Intel Corporation

Sasa is very good at explaining Android topics and gave us an excellent overview in a short time frame.

David - Vulnerability Research Labs

Actually, I am now wondering to attend your 5 days training to learn more about Android application develpment.

Lucas - Qualcomm, Inc.

I thought the class moved at a good pace. I am glad that the instructor did not expect us to be Java programmers and made us code in Java all the time. It made the class more enjoyable.

Harold - Research Dept.

fast pace, compressed learning.

Bastiaan - Intel Corporation

Excellent instructor. Knowledge of the subject is clearly extensive. Very good course material, I will definitely keep it for reference. Appreciated the tailoring of the material to our needs.

Ranjan - Intel Corporation

Marko was an excellent instructor. I feel very confident with the information I've learned over the past few days. Thanks.

Patrick - The MITRE Corporation

It is hard to rate everything as excellent but this really was an excellent course. Marko was very knowledgeable and knows how to present this work. I will surely benefit from having had this course. Great class and excellent instructor.

Prithvi - Texas Instruments

I think the training was very valuable for me and it will be very helpful to my feature work.

Michiyuki - Qualcomm, Inc.

Great content and excellent presenter and tutor!

Yichun - Cisco

Very Good instructor!

Siddharth - Qualcomm, Inc.

I have attended multiple training sessions over a period of 10 years but this is by far the best custom training I have been part of. Now I will have a short turnaround time to implement what I learned in my project thanks to the technical clarifications provided by Marko!

Srinath - Texas Instruments

Thank you very much for your great presentation

Hirokazu - Qualcomm, Inc.

Good material.

Henry - SLA-HB

Thank you so much pretty nice training.

Kei - Qualcomm, Inc.

Marko was great, he explained stuff really well, he gave personal attention to everybody in the class. He knew his stuff very well and he kept the class at the right pace. Thanks Marko!! It was great having you here..

Rohit - QIS Eng Test

I like the pace. Very fast. Before this class I had not touched the Android build. I had only created a few small apps. I felt I was able to keep up because of the organization of the class.

Tom - Intermec Technologies Corp.

Thanks for jumping into example code to answer our questions.

Julie - Texas Instruments

Very good.

Dongchun - QRD