The course main lab

In the labs, you get to build an HIDL service (Android 8), a persistent Java app (can't be killed), a Java SDK Library (Android 10) and AIDL for HAL service (android 11).

You will learn how to set the right SE Linux rules or macro to solve all these AVC denied errors.

You get to use gdb and strace to debug native code.

Sample video - Dynamic partitions, super.img, A/B System updates and fastbootd


Sample video - Discretionary Access Control (DAC) in the Linux Kernel


Sample video - Android's Linux Kernel


Course curriculum

  • 1

    Ch1: Downloading the source, building & booting cuttlefish

    • What is the Android Open Source Project?

    • Hardware Prerequisites

    • Download Ubuntu 20.04 and VMWare

    • Setup an Ubuntu 20 Installation on VMWare

    • Setting up a Linux Build Environment

    • Download the Repo Launcher

    • Downloading the android-12.0.0_r15 branch of the Android Source Code

    • The Device Folder

    • Cuttlefish, Android Emulator and a Physical Device

    • The 'hmm' Command

    • Starting a Cuttlefish Build

    • Examining the Build's Output

    • Setup acloud for Local Instances (Android 12)

    • acloud Create: Booting Cuttlefish (Android 12)

    • launch_cvd --start_webrtc=true : Booting Cuttlefish without acloud

    • Developer Options

    • ADB Shell

    • Useful Tips

    • Windows Troubleshooting

  • 2

    Ch2: Security basics

    • Authorizing Real Device for ADB Connection

    • User IDs and the Discretionary Access Control

    • Mandatory Access Control - SE Linux

    • Process Status (ps) and Private Application Files in /data/data

  • 3

    Lab: Basic source code search

    • Find ps & Top Commands' Source Codes

  • 4

    Ch3: Build configurations, Images and Partitions

    • Android Make Build System

    • AndroidProducts.mk and COMMON_LUNCH_CHOICES

    • PRODUCT_MAKEFILES and Makefile Inheritance

    • Generic System Image (GSI)

    • Android Partitions

    • Dynamic Partitions, "super.img", A/B System Updates and "fastbootd"

  • 5

    Ch4: The Android Linux Kernel

    • Assignment: Download the Android Common Kernel; Build and Replace Cuttlefish, GKI & Kernel Objects

  • 6

    Vendor HIDL Lab 1: HIDL HAL

    • ICpu.hal : [email protected] HIDL Interface

    • eightman.mk : Android Makefile in Cuttlefish

  • 7

    Vendor HIDL Lab 2: default hw service implementation

    • Cpu.h : Extending ICpu

    • Cpu.cpp : HAL Implementation

    • service.cpp : HAL Implementation Wrapper

    • Android.bp: Service executable cc_binary

    • [email protected]: Vendor Interface (VINTF) Object

    • [email protected]: Init Daemon

    • DEVICE_FRAMEWORK_COMPATIBILITY_MATRIX_FILE

  • 8

    Vendor HIDL Lab 3: vendor SE Linux policies

    • dmesg & sepolicy/vendor/file_contexts

    • sepolicy/vendor/hal_cpu_default.te & avc denied

    • audit2allow & property_contexts

    • hwbinder_use macro

    • hal_cpu_hwservice & add_hwservice macro

  • 9

    Vendor HIDL Lab 4: testing the service and fixing DAC/MAC errors

    • CpuTester

    • Enable Access Permissions to the kernel driver (DAC)

    • Enable Access Permission to the kernel driver (MAC)

  • 10

    Vendor HIDL Lab 5: cpp HIDL client exposed via JNI

    • com_eightman_Cpu.cpp: Thin Native HIDL Client

    • onload.cpp: JNI_OnLoad

    • Android.bp: cc_library_shared

  • 11

    Vendor HIDL Lab 6: vendor Java SDK library

    • Cpu.java: Java Wrapper for Native Calls

    • Android.bp: java_sdk_library & com.eightman api

  • 12

    Vendor HIDL Lab 7: vendor platform app

    • EightmanServices.java : The Application Class

    • EightmanBroadcastReceiver.java : Receiving setScalingGovernor Broadcast

    • AndroidManifest.xml : com.eightman Persistent Android App

    • strings.xml : Strings Resources File

    • Android.bp : android_app

    • eightmanservices.te : SE Linux

    • Test the App

  • 13

    Vendor HIDL Lab 8: User Interface (UI)

    • activity_cpu.xml, styles.xml & colors.xml : cpu Control Layout

    • CpuActivity.java : cpu Control Activity

    • AndroidMainfest.xml : Adding CpuActivity

    • HIDL Vibrator on AOSP

  • 14

    Vendor HIDL Lab 9: Java HIDL client & Shared System Image (SSI)

    • Android.bp : Adding HIDL Java Libs

    • activity_cpu.xml : Adding New TextViews

    • EightmanServices.java : Instantiating a Java HIDL Proxy

    • CpuActivity.java : Adding Java HIDL Proxy Calls

    • Android.bp: Moving the App from the Vendor to the System_ext Partition (SSI)

    • dex2jar & jdgui

  • 15

    Vendor AIDL Lab 1: AIDL HAL

    • hidl2aidl, aidl_interface

  • 16

    Vendor AIDL Lab 2: service daemon

    • service.cpp : Service Holder Template

    • Android.bp : vendor.eightman.cpu-service

    • vendor.eightman.cpu-service.rc : Running the Service as a Native Daemon

    • vendor.eightman.cpu-service.xml : Defining a New vintf AIDL Object

    • device_framework_matrix.xml : Adding the AIDL Service

    • SE Linux rules: hal_cpu_service

  • 17

    Vendor AIDL Lab 3: cpu implementation

    • Cpu.h : Extending BnCpu (binder native)

    • Cpu.cpp : Service Implementation

    • service.cpp : Adding the Service to the vndservicemanager

  • 18

    Vendor AIDL Lab 4: vendor platform app

    • Android.bp : Adding the AIDL Jar

    • EightmanServices.java : Adding a New AIDL Java Proxy to the Application

    • CpuActivity.java & activity_cpu.xml : Adding the AIDL Call in our UI

    • eightmanservices.te : Adding SE Linux Rules

  • 19

    Lab: Debugging native code

    • Forcing a Crash

    • Debugging native HIDL/AIDL service with LLDB

    • Debugging Native Code with GDB (OLD)

    • dumpsys Support for Vendor Service

    • Tracing System Calls with strace

  • 20

    Dynamic analysis of running application using Drozer

    • Drozer install script

    • Drozer - available modules

  • 21

    Static analysis of APKs

    • Pull any app from a none-rooted device

    • Install apktool

    • Decode an APK (reverse engineer)

  • 22

    dumpsys of system services

    • service list

    • dumpsys SurfaceFlinger

    • dumpsys activity

  • 23

    Useful screenshots from source.android.com

    • Power Management

  • 24

    Extras

    • Sensors Path

    • Setup cuttlefish (Android 13)

    • launch_cvd - booting Cuttlefish (Android 13)

Student reviews

5 star rating

This is one of the best courses I have ever taken

mark robinson

The breadth and depth of material is astounding. I had a great time going through the course and will likely continue to revisit sections repeatedly for the ...

Read More

The breadth and depth of material is astounding. I had a great time going through the course and will likely continue to revisit sections repeatedly for the clear and concise explanation and examples.

Read Less
5 star rating

Good course

Ajmal Pazhedath

Well structured course, good contents and author usually responds within few hours to any question.

Well structured course, good contents and author usually responds within few hours to any question.

Read Less

Instructor

Instructor

Gil Zhaiek

๐Ÿ‘‹Hello, and thanks for taking the time to read this. I am the course designer and instructor for both public and private classes. Back in 2011, I joined Recon Instruments to redesign the Android OS so that it can function as ski goggles and sunglasses. Following Intel's acquisition of Recon, I left to travel & teach Android Internals, apps, and security to engineers from ๐Ÿ‡บ๐Ÿ‡ธ๐Ÿ‡จ๐Ÿ‡ฆ๐Ÿ‡ฒ๐Ÿ‡ฝ๐Ÿ‡ง๐Ÿ‡ท๐Ÿ‡จ๐Ÿ‡ณ๐Ÿ‡ฐ๐Ÿ‡ท๐Ÿ‡ฎ๐Ÿ‡ณ๐Ÿ‡ฉ๐Ÿ‡ช๐Ÿ‡ท๐Ÿ‡บ๐Ÿ‡ท๐Ÿ‡ด๐Ÿ‡ฑ๐Ÿ‡ป๐Ÿ‡ฎ๐Ÿ‡ฑ๐Ÿ‡น๐Ÿ‡ผ. I am pleased to share my knowledge about Android 12 Internals with you through this self-guided, step-by-step online course ๐Ÿ™

FAQ

  • Do I need to sign-up to access the free preview?

    Yes, with the Thinkific platform, you'll need to sign up to access the free preview.

  • What will I work on in the hands-on lab?

    You'll get to define different types of architectural modules, including an HIDL service from Android 8, Java SDK library from Android 10, and an AIDL for HAL service from Android 11

  • What version of Android (AOSP) does the courseware support?

    The latest - Android 12.

Get the Video Recordings

The recordings from my last public class