While most people associate Java and maybe Kotlin with Android, the low-level parts of the mobile OS are written in C and C++. But Google is now adding support for Rust for OS development.
“The Android Open Source Project (AOSP) now supports the Rust programming language for developing the OS itself,” Jeff Vander Stoep and Stephen Hines of the Android Team write in the announcement post. “For the lower layers of the OS, Java and Kotlin are not an option. Lower levels of the OS require systems programming languages like C, C++, and Rust. These languages are designed with control and predictability as goals. They provide access to low-level system resources and hardware. They are light on resources and have more predictable performance characteristics.”
Looking at a graphic that describes the architecture of Android (and its open-source AOSP underpinnings), it appears that the bootloader, Trusted Execution Environment (TEE), fastboot/recovery, hypervisor, kernel, drivers, and hardware abstraction layers (HALs) are all written in C/C++ today, while some other components, like media and Bluetooth/NFC are written in a combination of those lower-level languages and Java/Kotlin. Apps and the frameworks that developers use to write apps are written in Java/Kotlin.
So why add support for Rust? According to Google, Rust provides the same low-level control and performance as C and C++ but