The Android system architecture is the same as its operating system, and uses a layered architecture. From the structural diagram, the Android system architecture consists of four layers: application layer, application framework layer, system Runtime Library layer, and linux core layer.
1. Applications
Android is released together with a series of core application packages, including email clients, SMS Short Message programs, calendars, maps, browsers, and contact management programs. All applications are written in JAVA.
2. Application Framework
Developers can also fully access the API framework used by core applications. The architecture design of this application simplifies Component reuse; any application can publish its functional blocks, and any other application can use the released functional blocks without complying with the security restrictions of the framework ). Similarly, this application reuse mechanism allows you to easily replace program components.
A series of services and systems are hidden behind each application, including:
◆ Rich and scalable Views), which can be used to build applications, including lists, grids, text box boxes, and buttons ), A web browser that can be embedded.
◆ Content Providers) allow applications to access data of another application, such as the contact database) or share their own data.
◆ Resource Manager) provides access to non-code resources, such as local strings, images, and layout files ).
◆ Notification Manager) enables applications to display custom prompts in the status bar.
◆ Activity Manager) is used to manage the application lifecycle and provides common navigation rollback functions. For more details and how to write an application from scratch, see how to write an Android Application.
3. System Runtime Library
1) Library
The Android system architecture contains some C/C ++ libraries that can be used by different components in the Android system. They provide services to developers through the Android Application Framework. The following are some core databases:
◆ System C library-a standard C system function library libc inherited from BSD), which is specially customized for embedded linux devices.
◆ Media library-Based on PacketVideo OpenCORE. This Library supports multiple common audio and video formats for playback and recording, and supports static image files. The encoding formats include MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.
◆ Surface Manager-manages the display subsystem and provides seamless integration of 2D and 3D layers for multiple applications.
◆ LibWebCore-a new web browser engine that supports Android browsers and an embedded web View.
◆ SGL-underlying 2D graphics engine
◆ 3D libraries-implemented based on OpenGL ES 1.0 APIs. This library can use hardware 3D acceleration if available) or highly optimized 3D soft acceleration.
◆ FreeType-bitmap) and vector font display.
◆ SQLite-a lightweight relational database engine that is available and powerful for all applications.
2) Android Runtime Library
The Android system architecture includes a core library that provides most of the functions of the core library of the JAVA programming language. Every Android application runs in its own process and has an independent Dalvik Virtual Machine instance. Dalvik is designed as a device to efficiently run multiple virtual systems at the same time. Dalvik executable file of Dalvik virtual machine execution. dex), which is optimized for small memory usage.
At the same time, the virtual machine is register-based. All classes are compiled by the JAVA compiler, and then converted to the. dex format using the "dx" tool in the SDK is executed by the virtual machine. The Dalvik virtual machine depends on some features of the Linux kernel, such as the thread mechanism and the underlying memory management mechanism.
4. Linux Kernel
Android core system services depend on the Linux 2.6 kernel, such as security, memory management, process management, network protocol stack and driver model. The Linux kernel is also an abstraction layer between the hardware and software stacks.