Android Internals 101 : Android Internal Architecture Demystified
Hello Droids! Welcome back to the continuing multipart series of Android Internals 101. Today we will try to scratch the surface of android architecture framework. We will uncover the tech and the idea behind each layer of android architecture one by one simultaneously we will also deepen our concepts as well.
Now, without further ado let’s dive …
Android is modular layered framework, The layered software stack allows multiple skills of developers to work on different layer, now whether someone is working on an app layer as android application developer, or on a framework layer as a platform developer, etc. This layered architecture also makes dependencies loosely coupled.
To understand this we need know about the Hollywood Principle : It says “Don’t call us, we will call you“. In context of android it is nothing but IOC — Inversion of Control via callback.
Since android follows framework pattern architecture and not component based or service oriented architecture. So we know one thing that framework owns event loop, and hence android framework also follows the same.
Now coming to every layer as depicted in above diagram. Each layer has its own functionality and responsibility to perform. Generally what we learned from android boot process, We looked from Linux kernel Level to App Level.
But today we will learn inversely i.e. From Apps Layer to Linux Kernel Layer.
Now let’s see the break down of each layer, one by one with its functionality and control flow …
Application Layer :
Both application i.e. System level apps and non system level apps belongs to the application layer
It is responsible for direct interaction with users, usually application on this layer were developed in Java or Kotlin and some CPU intensive task can also wrote in C++ via JNI interface.
Application Framework Layer :
The application framework layer provides developers with the essential API’s which needed to develop applications.
This layer is written in Java code and can be called Java framework.
Main components provided by the application framework layer :
Activity Manager - Manages the lifecycle of each application and the usual navigation fallback function.
Location Manager - Provides the geographic location and positioning function services.
Package Manager - Manages all application installed in the android system.
Notification Manager - Allows the application to display custom prompt information in the status bar.
Resource Manager - Provides various non-resources that the application uses such as localized string, picture, layout files, color files, etc.
Telephony Manager - Responsible for managing all telephony-related functions on a device such as network and sim information, SMS, call management, data connection, etc.
Window Manager - Manages all open window.
Content Provider - Allows data to be shared among different application on a same device using IPC.
View System - Builds the essential view components of an application.
System Runtime Layer (Native Library) :
- C/C++ Library : The C/C++ library can be used by different system components and provides developer service through the application framework.
1. OpenGL ES - 3d drawing function library.
2. Lib c - Standard C system function library inherited from BSD, specially customized for embedded linux based devices.
3. Media framework - Multimedia library supports recording and playback of various commonly used audio and video formats.
4. SQLite - The lightweight relational database engine.
5. SGL - The underlying 2d graphics rendering engine.
6. SSL - The secure socket layer is a security protocol that provides security and data integrity for network communication.
7. FreeType - Portable font engine, it provides a unified interface to access a variety of font format files.
Android Runtime Library :
The runtime library is divided into the core library and ART after android 5.0 i.e. Lollipop.
Dalvik virtual machine was replaced by ART environment.
The core library provides most of the Java language core library functions so that developers can use the Java language to write android applications.
The ART / Dalvik VM is specifically customized for mobile devices, allowing multiple instances of VM (sandboxes) to run in limited memory simultaneously, and each Dalvik application is executed as an independent linux process.
Hardware Abstraction Layer :
The hardware abstraction layer is the interface between the operating system kernel and the hardware circuit.
It’s primary purpose to abstract out the hardware to protect the intellectual property rights of hardware manufacturer.
It hides the hardware interface details of a specific platform and provides a virtual hardware platform for the operating system.
So that’s how it achieves hardware independence hence it can be transplanted on various platforms as well.
Linux Kernel Layer :
Android core system services are based on the linux kernel and some android specific drivers has been added on this basis.
It is responsible for handling various tasks, including managing system security, memory management, process management, network protocol stack and various driver model also depends on the kernel.
In the next article we’ll see such interesting topics of android internal’s, stay tuned. If you like please share with your friends, Please write your feedback for further improvements. Happy learning.
Let me know your experience about reading of this blog on my email.
Subscribe to my newsletter
Read articles from Faraz Sheikh directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Faraz Sheikh
Faraz Sheikh
Hiya 🖐 I’m Faraz Sheikh, a curious & creative software engineer from India. I like to solve complex engineering problems in a simplest possible way, based on learn by doing principle. I also likes to design software system, front-end mockups for personal and commercial projects. Past time includes ✍️ writing technical blogs, 📺 anime, 🏏 cricket and 🗺️ exploring world. And I hope we shall work together on X great ideas. 🤝 Thank You 🤝