Android system architecture, android system architecture
The Android system is divided into four layers: Linux kernel, Android core library, Android Runtime Environment (Android Runtime ),
Application Framework and applications.
Linux Kernel)
Android's core system services depend on Linux 2.6, such as security, memory management, process management, network stack, and driver model.
Linux Kernel is also an abstraction layer between hardware and software. It hides specific hardware details and provides unified services for the upper layer.
In addition to the standard Linux kernel, the Android system also adds kernel drivers, such as the display driver, Bluetooth driver,
Camera drive, flash card drive, Binder IPC drive, input device drive, USB drive, WiFi drive, audio system drive, Power Pipe
To provide basic support for running Android systems.
The advantage of this layer is to use the services provided by the lower layer to provide unified services for the upper layer, shielding the differences between the current layer and the following layers.
When a layer or lower layer changes, the upper layer is not affected. That is to say, each layer performs its own duties, and each layer provides a fixed SAP (Service Access
Point), that is, high cohesion and low coupling.
Android core library (Libraries)
Android contains a collection of C/C ++ libraries for various components of the Android system. These functions are used in Android applications.
The Application Framework is presented to developers. The following lists some core databases:
1. System C library-the standard C system function library (libc) derived from BSD is adjusted to a Library Based on Embedded Linux devices.
2. Media Library-Open Core Based on PacketVideo. These libraries support playing and recording a variety of popular audio and video formats,
And multiple media formats, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
3. Interface Management-display the sub-system manager, manage access display sub-systems, and seamlessly combine 2D and 3D applications
Graphics layer.
4. LibWebCore: a new Web browser engine that drives Android browsers and embedded Web views.
5. SGL-Skia graphics library, basic 2D graphics engine.
6. 3D libraries-Based on OpenGL ES APIs. This library uses hardware 3D acceleration or highly optimized 3D software acceleration.
Speed.
7. FreeType-Bitmap and Vector font rendering.
8. SQLite-a powerful and lightweight relational database engine that can be used by all applications.
Android Runtime Environment (Android Runtime)
There is also an Android runtime layer on the Linux kernel layer, which includes the Dalvik Virtual Machine and Java core library, providing the Java
Most functions of the core library of programming languages.
The Dalvik virtual machine is a Java Virtual Machine Used by Android. Every Android application is an instance in the Dalvik virtual machine.
In their own processes. The Dalvik virtual machine is designed to run multiple virtual machines efficiently on one device. Dalvik Virtual Machine
The file format used for execution is. dex and. dex. They are a compression format designed for Dalvik and are suitable for systems with limited memory and processor speed.
Most virtual machines (including JVM) are stack-based, while Dalvik virtual machines are register-based. The two architectures have their own advantages and disadvantages,
Generally, the stack-based machine requires more commands, while the register-based machine requires more commands. DX is a set of tools that can
Convert Java. class to. dex format. A. dex file usually has multiple. classes. Because. dex sometimes has to be optimized
Increase the Part Size by 1 ~ 4 times, ending with ODEX.
The Dalvik Virtual Machine relies on the Linux kernel to provide basic functions, such as thread and underlying memory management.
Android Application Framework)
The application framework layer is located on the Android library and runtime. Android enables development by providing an open development platform
Users can access the API framework used by the core application, so that the reuse of components is simplified, and any application can publish it.
Functions and any other application can use these functions (subject to the security restrictions executed by the Framework ). This allows developers to compile
Its rich and novel applications allow you to freely take advantage of hardware advantages, access location information, run background services, Set alarms, and send status alarms.
Add notifications.
Each application is actually a set of services and systems, including:
View: a rich and extensible View set used to build applications. Including list (ListView) and grid
(Grid), text box (EditText/TextView), Button, and even embedded web browser (WebView ).
Content Providers-enables applications to access data of other applications (such as Address Book), or
Share your own data.
Resource Manager: provides access to non-code resources, such as localized strings, images, and la S.
File.
Notification Manager-enables applications to display custom prompts on the status bar.
Activity Manager-manages application lifecycles and provides common navigation rollback Functions
Android applications
Android assembles a collection of core applications and releases them together with the system. These applications include email clients, SMS
Programs, calendars, maps, browsers, contacts, and other settings. All applications are written in Java and developed by users.
Android applications and Android core applications are at the same level.