What is Android Really? | Android Internals From Scratch Ep 1
Summary
This video series embarks on a journey to understand Android from its foundational hardware to its application layer, using a Raspberry Pi 4 as the primary setup. It covers the hardware components, the process of building and flashing Android from source code (AOSP), and introduces essential tools like ADB for debugging and interaction. The series will delve into Android's internal architecture, emphasizing its Linux kernel foundation, key processes like Zygote and System Server, and the layered structure including HAL and the application framework. Practical experiments and source code exploration are planned to provide a comprehensive understanding for viewers, enabling them to modify and rebuild the OS.
Key Insights
Android is a complete operating system built on the Linux kernel.
Contrary to common perception, Android is not merely a phone OS but a full operating system layered on top of the Linux kernel, which manages core functionalities like process management, memory, drivers, and security.
Zygote is a crucial process for fast Android app startup by cloning itself.
The Zygote process is fundamental to Android's efficiency; when a new app launches, its process is created by cloning the Zygote process, significantly reducing app startup time.
Sections
Hardware Setup for Android on Raspberry Pi
Utilizing Raspberry Pi 4 as a powerful mini-computer for running Android.
The core hardware for this series is a Raspberry Pi 4, chosen for its capability to run a full Android operating system despite its small form factor. This device serves as the platform for all subsequent explorations into Android internals.
A 64GB micro SD card is used to store the Android image built from source.
The Android operating system image, compiled from source code using AOSP, is stored on a 64GB micro SD card. This card is then flashed with the Android image to be used with the Raspberry Pi.
Cooling is essential for the Raspberry Pi to prevent overheating during intensive tasks.
A fan cooler is employed to maintain the Raspberry Pi's temperature during heavy workloads such as software compilation or continuous Android operation, ensuring stable performance.
Adapters are necessary to connect the Raspberry Pi's micro HDMI output to a VGA monitor.
Due to the Raspberry Pi 4 using micro HDMI ports and the monitor having a VGA port, a micro HDMI to HDMI converter followed by an HDMI to VGA cable is used for display output.
USB Type-C power cable provides power to the Raspberry Pi board.
The Raspberry Pi 4 is powered using a standard USB Type-C power cable, especially since a touchscreen is not being used and a mouse is utilized for interaction.
Fan cooler connects to GPIO pins for continuous operation.
The fan cooler is physically connected to the Raspberry Pi's GPIO pins, specifically red to GPIO 4 and black to GPIO 6, ensuring it runs whenever the board is powered.
The Android system is built entirely from the Android Open Source Project (AOSP).
The Android operating system running on the Raspberry Pi is a custom build derived directly from the Android Open Source Project (AOSP), the same foundational code used for all Android devices.
Introduction to Android Internals and Tools
Android is a complete operating system built on the Linux kernel.
Contrary to common perception, Android is not merely a phone OS but a full operating system layered on top of the Linux kernel, which manages core functionalities like process management, memory, drivers, and security.
The series will cover Android from basics to advanced internals through experiments.
The series aims to explore Android's internals comprehensively, covering architecture, boot process, Zygote, System Server, Binder IPC, and custom service creation, all reinforced with practical experiments on the Raspberry Pi setup.
ADB (Android Debug Bridge) is a crucial tool for communicating with Android devices.
ADB is introduced as the primary tool for developers to interact with the Android OS from a computer. It allows for inspection of processes, reading logs, and executing commands within the Android system.
Connecting the Android device via USB enables ADB communication.
To establish communication with ADB, the Android device (Raspberry Pi) must be connected to the computer system via USB, after which the 'adb devices' command verifies the connection.
Interacting via ADB allows direct access to the Android operating system's shell.
Using ADB, users can open a shell session directly into the Android system, enabling command-line interaction and management as if operating within the device itself.
Android's underlying OS is Linux, hence commands like 'uname -a' show Linux kernel details.
When checking the operating system via 'uname -a', it reveals the Linux kernel version (e.g., 6.1) and hostname, confirming that Android is built upon the Linux kernel, not an entirely separate OS.
Zygote is a crucial process for fast Android app startup by cloning itself.
The Zygote process is fundamental to Android's efficiency; when a new app launches, its process is created by cloning the Zygote process, significantly reducing app startup time.
System Server manages core Android services and acts as the OS's 'brain'.
The System Server process is central to Android's operation, responsible for initiating and managing essential system services like Activity Manager, Package Manager, and Window Manager.
Android's version can be queried using the 'getprop' command.
System properties, including the Android version, can be accessed using the 'getprop' command. For example, 'getprop ro.build.version.release' reveals the specific Android version (e.g., Android 14).
Android's Layered Architecture
Android has a layered architecture from applications down to the Linux kernel.
Android's structure is organized into distinct layers: Applications at the top, followed by the Application Framework providing APIs, Native Libraries for low-level functions, the Hardware Abstraction Layer (HAL) for hardware interaction, and the Linux Kernel at the base managing resources.
The HAL standardizes hardware interaction for Android.
The Hardware Abstraction Layer (HAL) serves as an interface, allowing Android's higher layers to interact with the device's hardware in a consistent and standardized manner, regardless of specific hardware implementations.
Screen mirroring via tools like scrcpy enables remote interaction and viewing.
Tools like scrcpy can be used to mirror the Android device's screen to a computer, allowing for remote viewing and even touch interaction, demonstrating the capability to control the device`s display externally.
Future of the Series
The next episode will explore the AOSP source code structure.
The upcoming episode focuses on navigating the Android Open Source Project (AOSP) source tree, understanding the roles of key directories such as frameworks, system, packages, hardware, and kernel.
Viewers will gain the ability to modify and rebuild Android.
By the conclusion of the series, participants are expected to possess a deep internal understanding of Android and the practical skills to modify and recompile the entire Android operating system.
Ask a Question
*Uses 1 Wisdom coin from your coin balance











![Learn C Programming and OOP with Dr. Chuck [feat. classic book by Kernighan and Ritchie]](https://i.ytimg.com/vi/PaPN51Mm5qQ/hqdefault.jpg)