The purpose of this tutorial is to explore the system architecture of the Android mobile operating system. This will give you a general idea of the various layers involved in Android and how they relate to each other. We will also talk about how Android relates to Linux itself.
Is Android really Linux?
This question comes up a lot. Many users do not understand how Android and an operating system like Ubuntu can both be considered Linux. After all, the two look and function completely differently.
Android and other Linux distros both have the Linux kernel at their core. As a result, many users will call these operating systems “Linux.” In reality, only the core of the operating system is Linux, and the rest is simply applications or libraries that are created to work with the Linux kernel.
Ubuntu and other mainstream desktop distros are commonly referred to as GNU/Linux, because they contain so much software from GNU. Android avoids this distinction because Google has written their own libraries and applications to work with the Linux kernel. The result is the Android operating system half the world has on their phone.
How does Android utilize Linux?
The Linux kernel provides an abstraction hardware layer for Android. This allows Android to be ported into a variety of different devices. Furthermore the Linux kernel is used for Android’s memory management, process management, networking and other underlined operating systems services. Core functionalities like Wi-Fi support and Bluetooth are provided by the Linux kernel.
Remember: at the core of every Android device is the Linux kernel.
Programs (or apps, as Android would call them) and system services require libraries in order to run properly. These libraries can be shared among many different apps and services. You can think of it as a set of instructions that provide the ability to run for many different things on the operating system.
These shared libraries are pre-installed on an Android device by each vendor. They are written in C/C++ language and allow 3D and 2D graphics, window manager, all sorts audio video formats, Sqllite database and etc.
Desktop Linux distros typically use the same libraries as one another. But for Android, Google has developed their own versions for many libraries, or modified existing ones to better fit the needs of their operating system. As an example, Google created their own version of
libc, a very common library that is present on all major Linux distros.
You can think of the Android Runtime layer as an extension to the Native Libraries layer. This runtime environment was created by Google and performs bytecode translation so that the code can be executed. In previous versions of Android, Dalvik Virtual machine code was used, but that has been discontinued in favor of Google’s in-house runtime.
Along with Google’s own runtime environment, there are some Java core libraries in this layer. The Java Runtime Environment utilizes OpenJDK. There is a JIT compiler that allows for consistent performance of applications and conservation of storage space.
The inclusion of Java on Android has led to much legal drama between Google and Oracle, which can be a fun read when you’re in the mood.
The application framework provides an interface for developers to interact with high level services within Android. Examples include a window manager and notification manager. Without this framework, developers (and subsequently the apps they create) would be very limited with what they can do in terms of interaction with the operating system or phone hardware.
Applications and Widgets
Finally, we reach the highest level layer of the Android system architecture. This is what all end users become very familiar with – the applications and widgets themselves. As you can probably surmise, this layer accepts input from the end user, and executes code based on that input in order to achieve the desired result.
Things like the home screen, applications, widgets, contacts, and other things that the user can directly interact with are all considered part of this highest level layer.
Hopefully this tutorial has given you a clear idea of how the Android operating system is structured. We have also tried to highlight the main differences between Android and a typical Linux desktop distro, since many users have confusion surrounding this. As an end user, the only layer you will ever worry about is the application layer. App developers will also interact with the application framework layer. Beyond that, the rest is for Google and the Linux kernel maintainers to take care of.