Greetings!We have recently published 100+ articles on android tutorials with kotlin and java. If you need, you may visit Android Tutorial for beginners page. You can also check Kotlin Tutorial for beginners. Also, if you are interested in content writing, you can mail us at email@example.com.
In this tutorial, we will see an overview of android architecture.
Android is an open source, Linux-based software stack created for a wide array of devices and form factors. This is being used in mobile, tablet as well as in TV. It is divided into 6 sections and five main layers.
The below picture depicts the division clearly.
Different sections in android architecture
The 6 main sections are as below –
a. Linux Kernel
b. Hardware abstraction layer
c. Native c/c++ libraries
d. Android Runtime
e. Java API framework
f. System Apps
1. Linux Kernel
Linux kernel is the foundation of the android platform. Layers such as Android Runtime depends on linux kernel for basic functionalities such as threading, memory managements etc. it also allows manufacturer to develop driver for a well known kernel. Linux kernel also provide key security features including
a. A user-based permission model. For example, you can not read some other user’s profile.
b. Process isolation.
c. Extensible mechanism for secure Inter-process communication.
d. Ability to remove un-necessary and insecure parts of the kernel.
This layer also provides a level of abstraction between the device hardware. It contains all the hardware drivers. For example, Display driver, Camera driver, Bluetooth driver, Flash Memory driver, Binder driver, USB driver, Keypad driver, Wifi driver, Audio driver, Power management etc.
2. Hardware Abstraction layer
It contains multiple library modules. Each module implements interface for a specific type of hardware component. For example, Camera module, Bluetooth module, Audio module, Sensors module etc. Whenever a request to access device hardware is made, the Android System loads the library module for that hardware component.
3. Native C/C++ libraries
Android components and services are made up of native codes that finally needs some native libraries. These native libraries are written in c and c++. Android platform provides java api frameworks to make developers enable to use functionality of such libraries. For example, For drawing and manipulating 2D and 3D graphics in android application, we use Java OpenGL api. This Java OpenGL api access OpenGL ES.
This section consists of such java based libraries. Such libraries helps developer in user-interface building, graphics drawing and database access. Some of the popular libraries are as below –
1. android.app – It enables to access the application model.
2. android.content – enables to access content, communicate between different applications etc.
3. android.database – Enables to access database.
4. android.opengl – Enables to access OpenGL ES 3D graphics rendering api.
5. android.os – Enables to access operating system services, messaging, inter-process communications etc.
6. android.text – Enable to manage and render text display.
7. android.view – It is fundamental building block of application UI
8. android.widget – This contains several views such as button, textview etc. These are used to develop application.
9. android.webkit – Enables to implement web browsing into android application.
4. Android Runtime
This layer was designed to run the application in low memory as well. In device that has Android version 5.0 or higher, each app runs in it’s own process. Also, it has it’s own instance of Android Runtime. ART is written to run multiple virtual machine on low memory devices by executing DEX files. DEX files is a bytecode format designed for Android. Some of the major features of ART is as below –
a. Optimised Garbage collector.
b. Ahead-of-time(AOT) and Just-in-Time(JIT) compilation.
c. Improved debugging support.
Before Android 5.0, Dalvik was the Android Runtime. If any application runs properly in Android Runtime, then, it will work properly in Dalvik as well. But, the vice-versa may not be true.
This layer also contains some core libraries that provides most of the functionality of the Java programming language that Java api framework uses. Thus, it enables android application developers to create project using Java programming language.
5. Java API Framework
This layer provides many higher level services as java class. You can use this class into your application to use such services. Services are
1. Resource Manager: It helps to access values from strings file, layout files etc.
2. Notification Manager: It enables to display notification in status bar.
3. Activity Manager: This manages app life cycle and navigation back stack.
4. Content Providers: Used to access data from other apps. For example, Access contacts from contact app etc.
5. View System: Used to build application UI. You can make structures like list, grid, textview etc.
6. System Apps
This is top layer and contains all the android applications. The android applications may be core apps or built by the user. Some core apps may be for Email, Messaging, calendars etc. This app does not have a special priority from the app that user choose to install. User can choose any app to send email of his/her own choice.
Android is an open source, Linux-based software stack created for a wide array of devices and form factors. Basically, android architecture is divided into various sections. We have tried to explain each sections in android architecture clearly. If you find any difficulty, please let me know in comment section.