Introduction to "Translate" Android system

Source: Internet
Author: User

Brief introduction

This article focuses on the basics and architecture of Android, this article topics:

    • Profile What Android is and why developers need to focus on Android;
    • Android architecture (such as Linux Kernel, Libraries, Android Runtime, application Framework, applications) and the main components for building Android apps (activities, Services, broadcast receivers, Content Providers);
    • Extensions: Intent and fragement;

Background

    • It is best to have some knowledge of Java development;
    • Android development environment; (another translation article)

About Android

Android is an operating system designed for smartphones and tablets based on the Linux kernel. Android was originally created by Andy Robin in early 21st century, was acquired by Google, and was named Android in 2005. Android is owned by the "Open Phone alliance" and maintained by Google.

Android's biggest advantage is its open source, which currently has a large number of devices supporting Android, and has built an Android ecosystem.

The first Android phone G1 was produced by HTC, and Google's Android team released the Android SDK version 1.0 in the same period. Android Version history:

Android and other mobile platforms

is an introduction to Android and other mobile platforms:

Here are some reasons why you choose android (translators do not have good words, keep the original words here):

    • Multiple devices
    • Screen size
    • Widgets
    • Changeable keyboard
    • Deep Cross-app Integration
    • Better User Interface
    • Cloud-connected Experience
    • Price points
    • Customization
    • Live Wallpapers
    • Custom launchers
    • Custom ROMs
    • Speed of improvement

Why should developers care about the development of Android systems or applications?

Android is growing fast, and with Android Open source, developers can gain insight into the design and use of Android-related APIs and have the opportunity to contribute to the Android community.

At the same time, developers can use open-source tools to build Android applications, currently, Android system has been widely used in mobile phones, tablets, televisions, watches and cars and other fields; So for developers, Android has a broad market.

Android architecture

Linux Kernel

The Android system relies on the Linux 2.6 kernel for security management, memory management, process management, network management, and driver Model Management at the bottom. The Linux kernel layer consists of various drivers, such as cameras, WiFi and video.

Although the Android base uses Linux Kernel, it is not fully used, and Android has also targeted some encapsulation or modification on the original kernel.

Android Libraries

The following are the main modules of the Android Libraries layer package:

    • FreeType-a high-quality font engine that supports bitmap and vector formats;
    • Sgl-2d The core library of the graphics Rendering engine;
    • LIBC-optimized C standard library based on Linux embedded development;
    • SQLite-a lightweight relational database;
    • SSL-Security protocol for network communication;
    • OpenGL es-3d Graphics Rendering engine;
    • WebKit-browser kernel;

The following are the core API packages provided by Android devices:

  • Android.view-View package containing the core user interface interface;
  • Android.widget-All widgets are packaged based on the view package, providing a unified UI element such as buttons, lists, etc. for developers to reuse;
  • Android.os-consists of operating system packages (operating System package), mainly used for debugging applications, tracking applications, messaging machines, controlling the power state of devices, and providing tools for managing system processes;
  • Android.util-android's Toolkit (Util package) consists of a number of basic tool classes, such as: string format, read/write JOSN data, XML parsing, time processing and event log reading, etc.
  • Android.graphics-android Graphics interface consists of some basic graphic classes, such as: canvas, colors, drawing primitives, etc.
  • The Android.text-android text package mainly contains the tools used to come out the text;
  • Android.database-a tool class that mainly contains some databases; SQLite is the default database used by Android, and Android uses SQLite to store some private data, and this package also contains some tool classes that come out of the content provider;
  • Android.content-android content consists of classes that read and publish data on the device, as well as services for resource management, content share, and package management (packages management);
  • Com.google.android.maps-provides controls and APIs for Google Maps;
  • Android.app-provides read application Model; mainly includes activities and service APIs;
  • Android.provider-provides access to standard content provider such as calendars, media, and contacts; You can use some of the classes provided by the provider package to add or remove predefined data from the Conteng provider;
  • Android.telephony-telephony APIs mainly provide the management of telephone communication API, such as: telephone, management phone status and send information, etc.;
  • Android.webkit-provides some web-related APIs. For example, WebView controls can be embedded in the activity browser and cookie management;
  • Android.security-handling security subsystem;
  • Android.network-handling network access;

Android Runtime

The Android application and its application framework are almost always developed using Java. Unlike a JVM virtual machine, Android uses another runtime virtual machine, Dalvik.

The key difference between the Dalvik and the JVM is that Dalvik is register-based (register), and the JVM is stack-based (STATCK), Dalvik is designed to run on small and low-CPU devices, while also considering the efficiency of multiple applications running concurrently;

(Note: Dalvik uses the underlying Linux kernel to manage memory and threads)

In Android 4.4, the new virtual machine art (Android run time) was introduced, and art compiles the app's cost code (native) when the app is installed. Art can dramatically improve the efficiency of your program, because you don't need the app to JIT-do just in time compilation at every run.

(Note: Using art takes longer to install than Dalvik, but the benefits are obvious)

Key Features of Art:

    • Pre-compilation (Ahead of Time (AOT) compilation), the new runtime Art introduces a new compilation mechanism, which translates the program into local code when the program is installed, which can greatly improve the efficiency of the program because there is no need to do just in every time the app runs Time compilation; But it is time-consuming to install, but this is only once; art uses the Dex2oat tool to compile applications on the device, dex2oat receive. Dex as input, compile to generate machine executable code.
    • Improved garbage collection (garbage collection), Dalvik two pauses during garbage collection and takes 10 milliseconds; art has a pause and time consuming only 2 milliseconds; the full GC in art is also after the phone lock screen , Art uses a new memory allocator:rosalloc.

Application Framework

The application framework offers a variety of APIs for developing Android apps. This layer has a lot of documentation to learn, and it's recommended that developers get to know it, so it's easy to create a lot of innovative and good apps.

Android provides a development environment where developers can use these APIs for free, such as running services in the background, notifying them, reading location information, and so on.

    • Activity Manager-is a very important component to manage the life cycle of an application;
    • Content Provider-Manage data sharing across applications;
    • Location Manager-Manage position information, GPS and cell phone base stations;
    • Package Manager-keeps track of installed applications;
    • Telephony Manager-manages mobile communication services on devices;
    • Resource Manager-Manage applications using a variety of resources;
    • Notification Manager-manages the display of customized prompts on the status bar;

Applications

Applications is the topmost layer of the Android architecture, and the applications we develop are mostly in this layer, and are developed using Java; Here are some of the default layers:

    • Web Browser
    • SMS Client
    • Dialer
    • Contact Manager

PS: It took me half a day to translate so much on and off. The original is a bit long, here first, and then a continuation.

Note:

1. This article in the translation process has been omitted;

2. The key words are not translated, and one side confuses understanding;

3. Original: Http://www.codeproject.com/Articles/802449/Article

This article version history:

Initial version 2014.08.31

Introduction to "Translate" Android system

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.