If you are an Android user, you may know how to carry out the basic functions such as making a call, sending a text message, changing the system settings, install or remove apps etc. Well! Every Android user knows these, but is it enough for you as a developer? Of course Not! So, what else things do we need to know for being successful developers? I’ll explain. We should know all the key concepts of Android OS. That is the nuts and bolts of the Android OS. Here we will explore the Android architecture in detail. By the term Android architecture, I mean the building blocks of the Android OS.
Android Architecture Diagram:
Before you start looking at the diagram, keep these points in your mind.
1. Android OS is made of different layers of software.
2. Each layer provides different services to the layer just above it.
3. Together it will make the OS, middle ware and applications.
Now look at the diagram:
So, the layers we referred to in the top are:
1. Linux Kernel
3. Android Run time
4. Application Framework
5. Android Apps
The app that we develop will go to the Android Apps layer.
Now we will look at each of these layers in detail:
1. Linux Kernel
The basic layer is the Linux Kernel. The whole Android OS is built on top of the Linux Kernel with some further architectural changes. Please don’t get confused by the terms Linux and Linux Kernel. The term Kernel means the core of any Operating System. By saying Android is based upon Linux Kernel, it doesn’t mean that it is another Linux distribution. It is not like that. It simply means, Android at its core is Linux. But you can’t run any linux packages on Android. It is a totally different OS. It is this Linux kernel that interacts with the hardware and it contains all the essential hardware drivers. Drivers are programs that control and communicate with the hardware. For example, consider the Bluetooth function. All devices has a Bluetooth hardware in it. Therefore the kernel must include a Bluetooth driver to communicate with the Bluetooth hardware. The Linux kernel also acts as an abstraction layer between the hardware and other software layers. As the Android is built on a most popular and proven foundation, the porting of Android to variety of hardware became a relatively painless task.
The next layer is the Android’s native libraries. It is this layer that enables the device to handle different types of data. These libraries are written in c or c++ language and are specific for a particular hardware.
Some of the important native libraries include the following:
Surface Manager: It is used for compositing window manager with off-screen buffering. Off-screen buffering means the apps can’t directly draw into the screen, instead the drawings go to the off-screen buffer. There it is combined with other drawings and form the final screen the user will see. This off screen buffer is the reason behind the transparency of windows.
Media framework: Media framework provides different media codecs allowing the recording and playback of different media formats
SQLite: SQLite is the database engine used in android for data storage purposes
WebKit: It is the browser engine used to display HTML content
OpenGL: Used to render 2D or 3D graphics content to the screen
3. Android Runtime
Android Runtime consists of Dalvik Virtual machine and Core Java libraries.
Dalvik Virtual Machine
It is a type of JVM used in android devices to run apps and is optimized for low processing power and low memory environments. Unlike the JVM, the Dalvik Virtual Machine doesn’t run .class files, instead it runs .dex files. .dex files are built from .class file at the time of compilation and provides hifger efficiency in low resource environments. The Dalvik VM allows multiple instance of Virtual machine to be created simultaneously providing security, isolation, memory management and threading support.
Google has introduced a new virtual machine known as ART (Android Runtime) in their newer releases of Android. In Lollipop, the Dalvik Virtual Machine is completely replaced by ART. ART has many advantages over Dalvik VM such as AOT (Ahead Of Time) compilation and improved garbage collection which boost the performance of apps significantly.
Core Java Libraries
These are different from Java SE and Java ME libraries. However these libraries provides most of the functionalities defined in the Java SE libraries.
4. Application Framework
These are the blocks that our applications directly interacts with. These programs manage the basic functions of phone like resource management, voice call management etc. As a developer, you just consider these are some basic tools with which we are building our applications.
Important blocks of Application framework are:
Activity Manager: Manages the activity life cycle of applications
Content Providers: Manage the data sharing between applications
Telephony Manager: Manages all voice calls. We use telephony manager if we want to access voice calls in our application.
Location Manager: Location management, using GPS or cell tower
Resource Manager: Manage the various types of resources we use in our Application
Applications are the top layer in the Android architecture and this is where our applications are gonna fit into. Several standard applications comes pre-installed with every device, such as:
- SMS client app
- Web browser
- Contact manager
As a developer we are able to write an app which replace any existing system app. That is, you are not limited in accessing any particular feature. You are practically limitless and can whatever you want to do with the android (as long as the users of your app permits it). Thus Android is opening endless opportunities to the developer.
⇐Back to The Index of Android Development Tutorial
Stay tuned to EazyTutz for all future updates.
Did this tutorial on Android Architecture help you? or did I miss any important point? What do you think? Suggestions, queries, criticism or whatever. I’d love to hear from you. Please add a comment below.