Understanding Android Platform Architecture

Reghill J Manuelraj
android-core
Published in
5 min readJul 1, 2020

We might be familiar with the Android platform and enjoy using all the applications from Play Store or any custom stores. But, have you ever wondered what is happening behind the screens for you to enjoy? Let’s try to figure it out.

Let’s try to go from scratch.

Consider that you are buying a brand new mobile phone(Let’s pretend that you buy an Android mobile even if you are a millionaire :P ).What will you do after unwrapping? Obviously , your Dopamine level boosts up and you try to switch it on.

Let’s pause and think for a moment..

Hmm.. How is it even possible for a hardware with delicate screen to come alive in a click of a button??

You might have guessed it. It’s the Operating System that is installed in the device that brings the hardware to life. Android is an OS built on top of Linux Kernel.

Linux Kernel

Kernel is the heart of Operating System. It takes care of memory management, driver management and most of the low level management. Simply put, it acts as a bridge between hardware and software to interact. And yes, this is the base layer of the Android Platform.

Let’s forget about the base layer and all the interior layers for now.

Now, your brand new phone is switched on by the magic of Kernel in OS. After switching on, what do you want to explore?

Yes, the applications.

Applications layer

This is the top most layer in your platform architecture. You might notice that there might be some inbuilt applications in your Android phone. These applications are called system apps. System apps and the other applications that you install fall into this top layer.

Let’s try to rearrange the blocks and see how long we have come.

Top and bottom layers of Android platform architecture

By now, you would have booted your brand new phone and explored all the applications in it. Now, let’s try to open explore some applications.

When you click on any application icon, what happens?

A new screen is launched. It is the same behaviour in all applications. Let’s consider the example of Whatsapp. When you click on the Whatsapp icon, a page with all your recent chats loads up. When you click on Calls tab in your Whatsapp app, it goes to another page. Thus, in any application, there might be n number of pages/screens based on our actions. These different screens that you see are developed using Java API framework called Activities and Fragments.

Application icons and application home pages

Java API Frameworks

Java API framework provides the basic building blocks that you need to create an application. Activity and Fragment are some examples of it. The notification that nudges you, the screens that you see, the UI interaction that you perform with an app and much more are built using Java API frameworks.

Technically put, this layer contains

  • Resource Manager
  • Notification Management
  • View System
  • Activity Manager,
  • Content Providers and much more..

Let’s dig a bit deeper.

Consider, you get a chance to visit one of the most beautiful places in the world with your brand new mobile. At that moment, what would you love to do?

Obviously, the most important priority of yours would be to take as many photos as possible, might add it to your social media feed and enjoy capturing memories.

You open the Camera application by clicking on the camera app icon.

What would happen?

Somehow , a magic happens and the real world objects / scenes that you see with your eyes will start appearing on your Mobile screen. Awesome , isn’t it? How is this magic happening?

Earlier, we discussed that Kernel would act as a helper to communicate with Hardware and we would build applications with help of Java API frameworks. There is a catch here. Kernel would help me but I need to ask Kernel for favour, right? That friendship bridge is provided by Hardware Abstraction Layer(HAL). Java API framework would inform HAL and HAL would trigger the Kernel to do the job.

Hardware Abstraction Layer

HAL is an abstraction layer which provides interfaces for interactions with Hardware modules such as Camera and bluetooth.

Okay, putting all these pieces together, we would get something like this..

Hold on.

I can design a fantastic app, I can have chit chat with Kernel and all this is awesome and cool.

But, how would my app run?

The answer is pretty simple. You get this job done with the help of Android Run Time(ART). All the applications run on their own process with an instance of ART.

Android Run Time

ART is artistically designed to help your application run. The application that you build is bundled as APK file. APK file is a bundle of DEX files. ART would execute these DEX files and your application comes alive.

Native C/C++ Libraries

Almost there. We have all these things perfectly in place. Now we need one final piece to complete this puzzle of Android platform Architecture. HAL and ART are very helpful for our application but these layers are built using native code. They make use of Native C/C++ libraries. So these libraries are exposed for us using Java API framework.

It is evident from their functions that both ART and HAL work closely with OS. Also, OS kernel is usually written in C/C++. Thus, it is clearly evident why they make use of native C/C++ libraries for their operation.

Finally, The Architecture

Putting all these pieces together, we get the complete platform architecture of Android.

Complete Android Platform Architecture

Native C/C++ libraries layer is put in the middle because of two reasons.

  • HAL is built using the native C/C++ Libraries.
  • Java API framework exposes some native C/C++ libraries to the developer for application requirements.

And, now the poor ART has no option but to stay there near Native C/C++ in a corner :)

Hope this article helps in understanding how Android is built. Happy learning!

--

--

Reghill J Manuelraj
android-core

An heuristic Application Developer with a hobby of scribbling my experiences