[Original] rookie version Android Note 1-Android architecture and Application, android1-

Source: Internet
Author: User

[Original] rookie version Android Note 1-Android architecture and Application, android1-
Android Architecture

Figure 1

The top-down names of the Android architecture are application layer, application framework layer, Runtime Library, Adroid Virtual Machine layer, and Linux kernel layer.

1. Application Layer

The application layer is like a brick in a building. Our development is basically at the application layer. The application layer software on mobile phones includes desktop, SMS, phone, browser, and buckle software. The application layer software is developed under the rules and support of the application framework layer. A. the application layer calls the APIS provided by the framework layer for development. B. The framework layer standardizes and manages the application layer software. The application layer software is developed for the framework layer. This layer is developed in java.

 

2. Application Framework Layer

The application frame layer is like the steel structure of a building. The application framework layer provides the Android development mode and all components and APIs required for Android development, and provides management functions. Many of the component APIs are implemented by calling the functions of the next layer through JNI. This layer is implemented using Java code. The framework layer also allows applications to securely publish services, activities, and data to other programs.

  • Activity Manager: manages application lifecycles and provides general navigation rollback functions.
  • Window Manager: Mainly used to manage the status, attributes, view addition, deletion, update, Window sequence, message Collection and processing of a Window.
  • Content Providers: provides data access and sharing functions for different processes.
  • Resource Manager: provides access to non-code resources, such as localized strings, graphics, and layout files.
  • Notification Manager: enables all applications to display custom prompts on the status bar.
3. function library and Android runtime Layer

Android is the foundation of a building, and the function library is like the root. All function libraries are implemented in the C/C ++ language and provide functional APIs for the framework layer. The framework layer can be called using JNI. The function library must call the Linux kernel.

Its important function libraries include:

 

  • Libc: a standard C System Library specially adjusted for embedded devices.
  • SGL/openGL | ES: graphics engine
  • WebKit: Browser Engine
  • SQLite: lightweight Relational Database
  • Media Framework: multimedia playback and recording Framework.
  • SurfaceManager: Manages access to the display subsystem.
  • Freetype: displays bitmap and Vector Fonts.

 

The Android runtime contains a core library and virtual machine program. The virtual machine program is a program that interprets and executes the android java bytecode. There are two types of Virtual Machine programs: Dalvik and ART. The Dalvik virtual machine provides the JIT Technology (Just-in-time Compiler) to compile frequently-run bytecode during runtime to speed up application operation. After 4.4, an ART virtual machine is provided. the ART technology performs a pre-compilation during application installation and converts bytecode into a machine language and stores it locally, in this way, the program will not be compiled every time, and the execution efficiency is greatly improved. However, this also leads to a longer application installation time. Every time you start the Android system, the system will install all applications, so the startup speed slows down. Every android application runs in a virtual machine process. It gives all processes and memory management to the runtime and stops or suspends the processes when necessary to manage resources more effectively.

The Android runtime and function library are on top of the Linux kernel, and the kernel processes the interaction with the underlying hardware. A set of Apis provide access to all underlying services, hardware, and functions.

 

4. Linux kernel layer

The Linux kernel layer is like the Earth. This layer is a Linux kernel + driver. Responsible for core system services such as memory management, process management, protocol stack, and driver model.

 

Android Application

1. The application priority is equal to the priority of the component with the highest priority.

2. The application is not equal to the process. An android application can have multiple processes: remote and process.

Priority

 

Active Process

Components that interact with users

The following situations are active processes:

A. Services in onCreate, onStart, and onDestroy

B. The service is running and marked as running on the foreground.

C. BroadcastReceiver in onReceive

D. Active Activity

Visible Process

The user can see but cannot interact, just as there is a pop-up window on the Activity.

Service Process

Process with service enabled

Background Process

Invisible, no service activity process.

Empty Process

Only for caching.

 

3. If application A depends on the service or provider of application B, the priority must be B>.

4. Ability to respond to application-level broadcasts (low memory ).

5. Because it is an application-level Singleton mode object, various components can obtain this object, so it can be used to pass data, maintain and manage data and do everything you want to do.

Application Event Callback

Event processing functions

 

OnCreate

Triggered at creation

OnLowMemory

Low memory event triggering with no parameters

OnTrimMemory (int)

The API provided after Android 4.0 is called back and forth based on different memory states. It will contain the int parameter, indicating the current status

OnConfigurationChanged (Configuration)

Configuration Change Handling

 

 

 

 

 

 

 

 

 

6. When the runtime configuration (for example, language, SIM card insertion, Time Zone change, and screen rotation) changes, it will not be restarted like the Activity.

Reprinted please indicate the source: http://www.cnblogs.com/stonehat/

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.