Android system architecture overview

table of Contents:

1. Android system architecture

2. Android class library

3. Four major components

Android technology exchange group 653583088, join now and receive it for free. How to make [your Android system framework ten times more elegant] information

1. Android system architecture

It can be seen from the architecture diagram that the architecture is divided into five parts, from bottom to top:

Linux Kernel: Android provides core system services based on Linux, such as security, memory management, process management, network stack, and driver model. Linux Kernel also acts as an abstraction layer between hardware and software. It hides specific hardware details and provides unified services for the upper layer.
Android Runtime: Android includes a collection of core libraries that provide most of the functions available in the core class libraries of the Java programming language. Each Android application is an instance in the Dalvik virtual machine. The running of the java program needs the support of the java core package, and then we run our application through the JVM virtual machine. The Core Libraries in the Android Runtime is equivalent to the java JDK, which is the core library required to run the android application, Dalvik Virtual Machine is equivalent to JVM, which is a virtual machine developed by Google for Android to run android applications. The file format of Dalvik is .dex. The dex format is a compression format designed for Dalvik, suitable for systems with limited memory and processor speed. Dalvik relies on Linux Kernel to provide basic functions, such as threads and low-level memory management.
Liberaries: Android includes a collection of C/C++ libraries for use by various components of the system. These functions can be exposed to developers through the Android application framework. Some core libraries are listed below:
System C library: A BSD derivative of the standard C system library (libc), adjusted to be based on embedded Linuxhe devices.
Media library: OpenCORE based on PackerVideo. These libraries support playback and recording of many audio and video formats, as well as static files.
Interface management: Manage access to the display subsystem and seamlessly combine the 2D and 3D graphics layers of multiple applications.
LibWebCore: (WebKit is an open source browser web page layout engine, including WebCore typesetting engine and JSCore engine) Web browser engine, which drives the Android browser and embedded web views.
SGL: Basic 2D graphics engine.
3D library: Implementation based on OpenGL ES APIS. The library uses hardware 3D acceleration or contains highly optimized 3D soft rasters.
FreeType: Bitmap and vector font rendering.
SQLite: Relational database engine.
Application Framework: Through an open development platform, developers can use framework APIs used by core applications. The architecture of the application is designed to simplify the reuse of components. Any application can publish its functions and any other application can use these functions (subject to the security restrictions enforced by the framework). This mechanism allows users to replace components. All applications are actually a set of services and systems, including:
View: A collection of views, including lists, grids, text boxes, buttons, and even embedded web browsers.
Content Providers: Content providers enable applications to access data of other applications (such as address books), or share their own data.
Resource Manager: Resource Manager provides access to non-code resources, such as localized strings, graphics, and layout files.
Notifacation Manager: The notification manager enables all applications to display custom warnings in the status bar.
Activity Manager: The activity manager manages the application life cycle and provides general navigation rollback functions.
Application: Androide assembles a collection of core applications, including e-mail, calendar, map, browser, address book, etc. Developers can also develop applications by themselves.


2. Androido common class library

Android.util: core toolkit
Android.os: operating system package, providing access to basic operating system services for n time, such as messaging and inter-process communication.
Android.graphic: Graphics API, provides low-level graphics classes that support canvas, color, and drawing, so that developers can draw on the canvas.
Android.content: Content API, which manages data access and release by processing resources, content providers, and a package services.
Android.view: The core user interface class. All user interface elements are constructed using a series of Views to provide interactive components.
Android.widget: Built on the basis of the View package, the Widget class is a user interface element that has been created, which can be used directly in the application, including lists, buttons, and layouts. Provides access to the local map space. application package, including activity (Activity) and service (service) API, forming the basis of all applications.
Android.provider: In order to facilitate developers to access certain marked content providers, the provider package provides some classes.
Android.telephony: Allows direct interaction with the phone stack to make calls, monitor phone status, and send and receive SMS messages.
Android.webkit: Provides APIs related to web-based content, including a WebView control, which can be embedded in a browser in the activity or cookiea manager.

3. Four major components

(1) Activity: Activity, a component containing a user interface, used to interact with the user. In Android programs, Activity generally represents a screen of the mobile phone screen. If you compare a mobile phone to a browser, then Activity is equivalent to a web page. You can add some Button, Check box and other controls in the Activity. You can see that the Activity concept is quite similar to the web page concept.

Generally, an Android application is composed of multiple activities. These multiple activities can jump to each other, for example, after pressing a Button button, it may jump to other activities.

Life cycle:

Three activity states: running (running at the front end), stopped (invisible, completely covered), paused (visible, but there are other activities in the front end)

Life cycle related methods: onCreate-onStart-onResume-onPause-onStop-onDestory-onRestart

(2) broadcastReceiver: broadcast receiver, no user interface.

Broadcast is a widely used mechanism for transferring information between applications. The BroadcastReceiver is a type of component that filters, accepts and responds to the broadcast sent out.

Use broadcastReceiver to allow applications to respond to external events. For example, when the external event of an incoming call comes, you can use BroadcastReceiver to handle it.

(3) contentProvider: a content provider that makes a specified data set of an application available to other applications. These data can be stored in the file system, in a SQLite database, or in any other reasonable way.

(4) Service: Service. Service is a component in the android system. It has the same level as Activity, but it cannot run by itself, it can only run in the background, and can interact with other components. Service is a long life cycle code without an interface.

The level of tivity is similar, but it cannot run by itself, it can only run in the background, and can interact with other components. Service is a long life cycle code without an interface.