Direct
From, we can see that the Android system architecture consists of five parts,
Linux Kernel, Android runtime, libraries, application framework, and applications ).
2.1 Linux Kernel
Android provides core system services based 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.
If you have learned computer networks and know OSI/RM, you will know that the benefit of layering 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 the current layer and the following layers change, the upper layer is not affected. That is to sayEach layer performs its own duties, and each layer provides a fixed SAP (Service Access Point)The major point can be said to beHigh Cohesion and low coupling.
If you are only engaged in application development, you do not need to have a deep understanding of the Linux kernel layer.
2.2. Android Runtime
Android contains a collection of core libraries, providing most of the functions available in the core library of Java programming language. Every android application is an instance in the Dalvik Virtual Machine and runs in its own process. The Dalvik virtual machine is designed to efficiently run multiple virtual machines on one device. The Dalvik Virtual Machine executable file format is. Dex. Dex is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed.
Most virtual machines, including JVM, are stack-based, while Dalvik virtual machines are register-based. DX is a set of tools that can convert java. class to. Dex format. A Dex file usually has multiple. classes. Because Dex sometimes needs to be optimized, it will increase the file size by 1 to 4 times and end with odex. (Note: during the conversion of. Class to. Dex files, Android will optimize it to adapt it to the small memory environment)
The Dalvik Virtual Machine relies on the Linux kernel to provide basic functions, such as thread and underlying memory management.
2.3. Libraries
Android contains a collection of C/C ++ libraries for various components of the Android system. These functions are exposed to developers through the Android Application Framework. The following lists some core databases:
- System C library-- The BSD derivative of the Standard C system library (libc) is adjusted to an embedded Linux device.
- Media Library-- Opencore Based on packetvideo. These libraries support playing and recording many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, Amr, JPG, and PNG.
- Interface Management-- Manage the access display subsystem and seamlessly combine the 2D and 3D graphic layers of multiple applications
- Libwebcore-- The New web browser engine drives Android browsers and embedded web views
- SGL-- Basic 2D graphics engine
- 3D Library-- Implemented based on OpenGL ES 1.0 APIs. Library uses hardware 3D acceleration or includes highly optimized 3D software Grating
- FreeType-- Bitmap and vector font rendering
- SQLite-- Powerful and lightweight relational database engine that can be used by all applications
2.4. Application Framework
By providing an open development platform, Android enables developers to develop extremely rich and novel applications. Developers can freely take advantage of the hardware advantages of devices, access location information, run background services, Set alarms, and add notifications to the status bar.
Developers can fully use the APIS framework used by core applications. The architecture of an application is designed to simplify the reuse of components. Any application can publish its features and any other application can use these features (subject to the security constraints executed by the Framework ). This mechanism allows users to replace components.
All applications are actually a group of services and systems, including:
- View)-- A rich and scalable set of views that can be used to build an application. Including list, grid, text box, button, and even embedded Web Browser
- Content Providers)-- Enables applications to access data of other applications (such as Address Book) or share their own data
- Resource Manager)-- Provides access to non-code resources, such as localized strings, images, and layout files
- Notification Manager (
Notification Manager)-- Enable all applications to display custom warnings in the status bar
- Activity Manager (
Activity Manager)-- Manages the application lifecycle and provides general navigation rollback Functions
2.5, Applications
Android assembles a collection of core applications, including email clients, SMS programs, calendars, maps, browsers, contacts, and other settings. All applications are written in Java programming language. More rich applications need to be developed!