The Android Platform Architecture
As an aspiring Android developer, we highly recommend you get a clear understanding of the Android platform – both it’s platform architecture as described in this article, and the activity life cycle.
The Android Operating System is composed of a total of 4 logical layers, with a total of 5 sections. This representation of the Android OS is often referred to as the Android Software Stack.
By glancing over the Android software stack below, we can actually see that the Android Operating System is built on top of Linux!
And on top of that, the Android OS is therefore open source. What more can we ask for? 🙂
Let’s work our way from the top-down in the Android software stack!
The Application layer is the layer where everyday users hangout all the time.
Of course, we can provide a fancy definition of this layer, but it’s actually as simple as this:
The Application Layer is where the applications reside.
Now, in the software stack above, the examples of applications are limited to System Apps, which are pre-installed default applications that comes with the Android OS.
However, the Android OS does not differentiate between system applications and third party applications.
In other words, if you create an app named “MyFavoriteApp”, it would also be part of the Application Layer.
For developers like us, the beauty of the application layer is that the apps can interact with each other.
Assuming you want your application to be able to take a picture. You don’t have to reinvent the wheel and make your own camera application – you can simply make use of the camera app which is preinstalled in the Android OS!
Applications Framework Layer
The Applications Framework Layer, sometimes referred to as the Java API Framework, provides a set of higher-level Java classes which you can make use of when developing an Android app.
Actually, the entire feature-set of the Android OS are provided through the Applications Framework, which makes your life as a developer a whole lot easier!
The key services provided by the Application Framework is as follows:
Use the coupon code LIMITED25 to get 25% off 😉
- Activity Manager: This manager is used to control the aspects of the activity life cycle and the activity stack.
- Content Providers: The Content Provider enables applications to interact with each other, sharing and publishing data.
- Resource Manager: The Resource Manager provides access to non-java files, such as localized strings, graphic files and layouts.
- Notification Manager: This manager enables applications to display custom alerts in the phone’s status bar.
- Window Manager: Responsible for keeping track of the order of the windows, which windows are visible, and how they are laid out on the UI.
- Telephony Manager: The Telephony Manager is responsible for voice calls.
- Location Manager: Responsible for location-based services.
- View System: A set of reusable views which makes up the user interface of an Android application.
- Package Manager: An API which handles installing, uninstalling and updating of Android applications.
As an Android developer, all of these services are available to you!
Below the Applications Framework we have the Libraries layer.
This layer contains the libraries that are necessary for a well-functioning operating system.
The libraries are Java libraries, developed directly for the Android OS.
Some of the important Java libraries for Android is as follows:
- Surface Manager: Allowing for different activities on the screen. Responsible for taking care of different windows, owned by different applications, and thus ran in different processes.
- Media Framework: Providing different media codecs, allowing recording and playback of different media types.
- SQLite: This library is used to access data published by content providers and includes SQLite database management classes.
- OpenGL | ES: OpenGL | ES provides a Java interface to the OpenGL | ES 3D graphics API.
- FreeType: Responsible for rendering fonts.
- Webkit: Browser Engine, displaying internet content / HTML pages.
- SGL: Scalable Graphics Library, a 2D picture engine.
- SSL: Providing Internet Security, i.e. HTTPS.
- libc: The C standard library.
For API level 21 and above, each application is running in its own process with an own instance on the Android Virtual Runtime (ART).
Before ART was introduced, Dalvik was used.
Note: As always, the Android OS provides great backwards-compatibility. In other words, if your applications works on ART, it should also work on Dalvik. However, it may not work out of the box if moving from Dalvik to ART!
ART wasn’t introduced just for fun. It contains a whole lot of optimizations, including:
- AOT & JIT compiling: Ahead-of-time and just-in-time compiling. Improving app performance.
- Improved Garbage Collection: ART optimized the workings of the Java Garbage Collector, resulting in better performance.
- Better debugging: In short, it made debugging easier. More detailed diagnostics and crash reporting etc.
In the Android Runtime there is also included a set of core libraries. These core libraries provide most of the functionality of the Java programming language, even introducing some features of Java 8.
Sidenote: Oracle has changed how often a new version of Java will be available, which is every 6th month from now on. It will be interesting to see if Android can keep up with this rapid versioning of Java!
The whole Android OS is built on top of the Linux Kernel.
Now, whole books are written on the workings of the Linux Kernel, so a complete description is clearly out of scope for this article.
The Linux Kernel is the foundation of the whole Android OS. It relies on key concepts which the Linux Kernel is really great at, such as power management, networking, a vast variety of device drivers, threading and low-level management.