Android Layered Architecture
Android has a layered architecture. Hence android is known as software stack or pile of software. It has five layers:
- Android Applications Layer: All the native and third party Android apps are built using same API libraries. They run within the android runtime. All the classes and services are provided by Android Application Framework Layer.
- Android Application Framework Layer: This layer manages the android user interface. It avails the classes required for creating apps. It provides an abstraction layer between the hardware and system resources.
- Android Runtime Layer: It is the basis of application framework layer. It provides power to our Android apps. It contains Core libraries and Dalvik virtual machine. Both of these components together make android phone an android device and not just any Linux implementation.
- Core Libraries: These libraries provide the functionality from android specific libraries and core java functionality.
- Dalvik Virtual Machine:DVM uses register-based architecture. Dalvik is open source software. It is designed in a way that each application runs on its own instance of DVM. So that crash of one application doesn’t affect the execution of any other application running in device.
- Libraries: These libraries are written in C/C++. It includes :
- SSL (Secure Socket Layer) :It provides security to the system as there is frequent use of internet.
- Media Framework: A media library to support audio and video.
- Surface Manager: It manages the display.
- SQLite: Supports native databases.
- Webkit: Integrated Browser to support browsing over internet.
- Libc: Libraries in C.
- Kernel: It provides an abstraction layer between hardware and rest of software stack. It is a Linux 2.6 kernel. It manages device drivers, power, network, resources, etc.
Now, what is a virtual machine? Let’s try to find some simple words for these technical terms:
1. Virtual Machine: It is a virtual implementation of a machine which executes like actual machine. The need for this is security and portability.
2. Portability: It is the ability of a program to run anywhere despite of different physical architecture or implementation. Code once and run anywhere.
3. Compilation: The process of converting the program written in your language to the language which your machine understands. In short, program is converted into machine code or low level language in which it can be executed.
4. Program: A sequence of instructions, which can be stored, interpreted and executed by computer.
5. Instruction: It is a basic command. In other words, it is the order given to the processor of computer by your program.
Make sure of one point, android is not extended java, nor java. Both are different. We will use javaas language so that we can make use of java compatible libraries for Android app development. Middleware, APIs and libraries are written in C. Application Software running on application framework are written in java-compatible libraries. Android runs Dalvik executable “dex-code” or”.dex” which is generated from java bytecode. Dalvik virtual machine uses JIT (Just-in-time) compilation.
Figure Android Architecture.