0, concept
The Android system architecture adopts a layered architecture, from low-level to high-level (5 layers):
Linux Kernel (Linux kernel), Hardware Abstraction Layer (hardware abstraction layer), Libraries (system runtime library or c/c++ core library), Application Framework (development framework package), Applications (core application).
(Older version was 4 layers: application layer, application framework layer, system library and android runtime and linux kernel)
1. Linux Kernel (Linux Kernel)
1) Concept
The foundation of the android platform is the Linux kernel. The final function implementation of the android system is completed through the linux kernel, such as Android Runtime (ART), which relies on the linux kernel to perform tasks such as thread and memory management.
2, Hardware Abstraction Layer (HAL, hardware abstraction layer)
1) Concept
The Hardware Abstraction Layer (HAL), which is an abstract interface driven by the device kernel, implements the application programming interface that provides access to the underlying device to the higher-level Java API framework.
The HAL contains multiple library modules, each of which implements an interface for a specific type of hardware component. When a framework API requires access to device hardware, the Android system loads library modules for that hardware component.
3. Libraries (system runtime library or c/c++ core library)
1) Concept
①Android core runtime library
Provides most of the features of the Java programming language used by the Java API framework, including some Java 8 language features.
Native C/C++ Libraries: Core Android system components and services (such as ART and HAL) are built from native code and require native libraries written in C and C++.
The Android platform provides Java framework APIs to expose the functionality of some of these native libraries to applications. For example, OpenGL ES is accessed through the Android framework Java OpenGL API to support drawing and manipulating 2D and 3D graphics in applications.
Applications developed with C or C++ code can use the Android NDK to access some native platform libraries directly from native code.
②Android Runtime(ART)
For devices running Android 5.0 (API level 21) or higher, each app runs in its own process and has its own instance of the Android Runtime (ART).
ART is written to run multiple virtual machines on low memory devices by executing DEX files, a bytecode format designed for Android that is optimized to use very little memory.
The compilation toolchain compiles the ava source code into DEX bytecode, making it runnable on the Android platform.
i> Some key features include:
Ahead of Time (AOT) compilation
Optimized Garbage Collection (GC)
Better debugging support including dedicated sampling profiler, detailed diagnostic exception and crash reporting, and the ability to set watchpoints to monitor specific fields
4, Application Framework (development framework package)
1) Concept
An API written in the Java language uses the entire feature set of the Android OS. These APIs form the building blocks needed to create Android applications, and they simplify the reuse of core modular system components and services.
2) Composition
①View System
Build your app's UI, including lists, grids, text boxes, buttons, and even an embeddable web browser
②Resource Manager
Access non-code resources such as localized strings, graphics and layout files
③Notification Manager
Allows all apps to display custom alerts in the status bar
④Activity Manager
Used to manage the life cycle of the application, providing a common navigation back stack
⑤Content Providers
Allows apps to access data from other apps (such as the Contacts app) or share its own data
5, Applications (core application).
The core apps that come with Android for e-mail, text messaging, calendaring, internet browsing, and contacts, as well as apps the user chooses to install, have no special status.
System apps can be used as the user's app, as well as provide the main functionality that the developer can access from his own app.