Android is divided into four tiers, from the high-level to the lower tier, which are application tiers, application framework tiers, System runtime tiers, and Linux core tiers.
The blue represents the Java program, the yellow code is the virtual machine that runs the Java program, the green part is the library written in the C + + language, the Red Code kernel (Linux kernel +driver). Under the application framework, it is composed of a C + + library that completes calls from Java to C via JNI.
1) Application
All applications are written in the Java language, each of which consists of one or more activities, activities must be superclass-like activities, activity is similar to the process on the operating system, but the activity is more flexible than the operating system process, and similar to the process, The activity toggles between multiple states.
With Java's cross-platform nature, Android-based applications can run on any Android-installed platform without compiling it, which is the essence of Android.
2) Application Framework
The architectural design of the application simplifies the reuse of components, and any application can publish its block of functionality and any other application can use its published block of functionality (subject to the security restrictions of the framework). Helps programmers quickly develop programs, and the application reuse mechanism also makes it easy for users to replace program components.
Hidden behind each app is a series of services and systems, including;
A. Rich and extensible view (views) that can be used to build applications, including lists (lists), grids (grids), text boxes (texts boxes), buttons (buttons), and even web browsers that can be embedded.
B. Content Providers enables applications to access data from another application, such as a contact database, or to share their own data.
C. Resource Manager (Resource Manager) provides access to non-code resources, such as local strings, graphics, and layout files.
D. The notification Manager (Notification Manager) enables applications to display customized prompts in the status bar.
E. Activity Manager is used to manage the application lifecycle and to provide common navigation fallback functionality.
3) System Runtime Library
A) Program Library
Android contains a number of C + + libraries that can be used by different components of the Android system. They provide services to developers through the Android application framework.
Here are some core libraries:
Mainly includes basic C library, and multimedia library to support various multimedia formats, bitmap and vector fonts, 2D and 3D graphics engine, browser, database support.
1.Bionic System C library.
2. Media Library, based on PacketVideo Opencore.
The 3.Surface manager, as its name implies, is used to manage Surface.
4.webkit,libwebcore Browser, based on Webkit engine.
5.SGL Bottom 2D Graphics engine
6.3D libraries based on OpenGL ES 1.0 APIs
7.FreeType Bitmap (bitmap) and vector font display.
8.SQLite a lightweight relational database engine that is available and powerful for all applications.
Also there is a hardware abstraction layer. In fact, Android not all device drivers are placed in the Linux kernel, a part of the implementation in the user space,
The main reason for this is to avoid the GPL that Linux adheres to, and generally, if you want to port Android to other hardware to run,
You just need to implement this part of the code. Includes: Monitor driver, sound, camera, gps,gsm and so on.
b) Android Runtime Library
Android includes a core library that provides most of the functionality of the Java programming language core library.
Each Android application runs in its own process and has a separate instance of the Dalvik virtual machine.
Dalvik is designed as a device that can run multiple virtual systems at the same time and efficiently.
Dalvik Virtual Machine Execution (. dex) Dalvik executable, which is optimized for small memory usage.
While the virtual machine is a register-based, all classes are compiled by the Java compiler and then converted to. dex format by the "DX" tool in the SDK to be executed by the virtual machine.
Dalvik virtual machines rely on some of the features of the Linux kernel, such as threading mechanisms and underlying memory management mechanisms.
4) Linux kernel
Android's core system services rely on the Linux 2.6 kernel, such as security, memory management, process management, network protocol stacks, and drive models.
The Linux kernel also acts as an abstraction layer between the hardware and the software stack. In addition, it has been partially modified, mainly involving two parts:
A) Binder
(IPC): Provides effective inter-process communication, although the Linux kernel itself has provided these features, but many of the Android system services need this feature for some reason
It has achieved its own set of.
b) Power management: Save energy for handheld devices.
Summary: Android itself is a set of software stacks, or software overlay architecture, mainly divided into three layers: operating system, middleware, applications.
Android (ii)--android architecture