Android INTERNALS.A First Chapter

Source: Internet
Author: User
Tags value store

This chapter is mainly about Android from the Linux branch but also has its own unique features such as dalvik,framworks,jni,bionic and so on.

    • 1.1 is mainly the development history of Android each version of the change

Wiki also has the corresponding update currently Android has been updated to 8.1 (note each version of the representative update feature) Https://zh.wikipedia.org/wiki/Android can see that 6.0 and 7.0 have accounted for about 50%.
    • 1.2 Differences in architecture between Android and Linux (emphasis)

It is obvious that the difference is that glibc replaced Bionic and HAL (mainly to avoid open source protocols) and then Android removed the unique x-windows and gnome/kde/etc on Linux, adding Dalvik JNi Frameworks, etc.
    1. Android's Frameworks layer
A large part of Android's success stems from his rich framworks, or it's just a simple embedded device. Android also allows developers to use a higher level of Java, rather than a low-class C + +, largely because Android's rich API is named after Java's package naming, and the Android framework is divided into separate namespaces, Table 1-2: the Android Frameworks (API 1~22)
Package Name Api Contents
Android.app 1 Application support
Android.content Content providers
Android.database Database support, mostly SQLite
Android.graphics Graphics Support
Android.opengl OpenGL Graphics Support
Android.hardware Camera, input and sensor support
Android.location Location support
Android.media Media Support
Android.net Network support built over java.net APIs
Android.os Core OS Service and IPC support
Android.provider Built-in Android content-providers
Android.sax SAX XML Parsers
Android.telephony Core Telephony Support
Android.text Text rendering
Android.view UI components (similar to IOS ' s UIView)
Android.webkit Webkit Browser Controls
Android.widget Application Widgets
Android.speech 3 Speech Recognition and Speech-to-text
Android.accounts 4 Support for account management and authentication.
Android.gesture Custom gesture Support
Android.accounts 5 User Account Support
Android.bluetooth Bluetooth Support
Android.media.audiofx 9 Audio Effects Support
Android.net.sip Support for VoIP using the Session initiation Protocol (RFC3261)
Android.os.storage Support for Opaque Binary Blobs (OBB)
Android.nfc Support for near Field communication
Android.animation 11 Animation of views and objects
Android.drm Digital rights Management and copy protection
Android.renderscript Renderscript (OpenCL like computation language)
Android.hardware.usb 12 USB Peripheral Support
Android.mtp MTP/PTP support for connected cameras, etc
Android.net.rtp Support for the Real-time-protocol (RFC3501)
Android.media.effect 14 Image and Video Effects support
android.net.wifi.p2p Support for Wi-Fi Direct (Peer-to-peer)
Android.security Support for Keychains and Keystores
Android.net.nsd 16 Neighbor-service-discovery through multicast DNS (Bonjour)
Android.hardware.input Input Device Listeners
Package Name Api Contents
Android.hardware.display 17 External and Virtual display support
Android.service.dreams "Dream" (screensaver) support
Android.graphics.pdf 19 PDF Rendering
Android.print[.pdf] Support for external printing
Android.app.job 21st JOB Scheduler
Android.bluetooth.le Bluetooth Low-energy (LE) support
Android.hardware.camera2 The new camera APIs
Android.media. [BROWSE/PROJECTION/SESSION/TV] Media Browsing and TV support
Android.service.voice Activation by ' hot words ' (e.g. "OK Google")
Android.system Uname (), poll (2) and Fstat[vfs] (2)
Android.shuylfhfduulhu 22 Sms/mms Support (Carriremessageingservice)
Frameworks is packaged as a jar package in the form of a device that is/system/framwork to boot.art files. 2.Dalvik virtual machine As the book is printed, Dalvik is being replaced by Android RunTime (ART), as described later in this chapter. However, contrary to popular belief, this does not mean that Dalvik is disappearing: only the Just-in-time (JIT) compilation is replaced, but the file format (DEX) is still very active and the key architecture is the same concept.          Therefore, we discussed Dalvik DnG ART in detail in the second volume.        3.JNI while Android programs run in virtual machines, it is often necessary to use JNI to create libraries in program code in order to access hardware or other devices. Google provides the NDK for our use. Works well when working with graphical interfaces and against anti-compilation. At the same time, in order to fit arm Intel itself made an emulator Intel provides a closed-source armemulation called Houdini (extending Dalvik/art, asdiscussed lat ER in Volume II) as part of theirandroid distribution. This emulator, (along with afew minor modifications in Dalvik), enables armnative libraries to work on Intel architectures         . 4. Binary files are found in/system/bin or/system/xbin directories

Compiling Android source code will use Ndk-toochains to cross compile

5. Bionic Android uses its own C runtime library, Bionic Bionic is open source, but uses the ABSD license (which is more tolerant of third-party links) and the Android Hybrid's own license. 6. Added features aside from legal issues, Bionic is more lightweight than glibc and more efficient for Android. Bionic system calls are stored in the bionic/libc/syscalls. TXT, and of course some system calls are not exported. System V IPC not supported, limited pthread function: On the one hand, pthread support is built into Bionic limited C + + support: While C + + is supported (indeed, most Android code is written in C + +), the exception is not.  Similarly, the Standard Template Library (STL) is not included, but there is no limit to manually linking it (a port can find an external/STLport project). Added functionality: The System Properties: properties are unique to Android, which allows the system as well as applications that provide various configuration and operation parameters in a simple key/value store. This is similar to the concept of Java properties (which is actually accessible through Java's system.properties). Android relies heavily on this mechanism, provided through shared memory regions, accessible and read-only to all processes on the system, but only through/init settings. Hard-coded implementations of Uid/gid: instead of relying on password and group.
Built-in DNS resolution: Bionic integrates DNS name-to-IP parsing code (typically in libresolv.so).hard-coded services and protocols: A complete solution to libresolv.so. Removed support for files and protocols from the *nux section7. Migration challenges: The main problem point in the transplant is in bionic,Although to some extent compatible with gun libc, some functions such as notably multithreading
, it will not be ported. Android has the same system call as Linux, and the static binaries are fully compatible. In addition to Bionic, Android also contains some other important runtime libraries to support dalvik,frameworks and system processes.
libraries in System/core typically provide kernel-androidisms packaging or implement additional functionality in user mode, including:

When I see this zipfile, I feel like these libraries are fuzz to see if we can find some problems.

Frameworks/provide provides native support services for the Android framework.

 

These are viruses that are often injected into a system library such as Libandroid_runtime.so

Additional Local libraries

Android has more than 150 additional local libraries once deployed on the device, the external libraries are largely indistinguishable from the aosp and they are in the System/lib directory (some also in/verndor/lib)


Hardware abstraction layers (Hardware abstraction layer)
Because Android wants to run on a variety of devices, the underlying hardware specification gap is a big one, so Android defines the (HAL) unified Standard to provide hardware providers the freedom to create their drivers in kernel mode
He only needs a binary file to be placed with SYSTEM/LIB/HW directory libhareware.so will actively load them (we will also need to download the driver of the corresponding device in the specified directory when compiling the Android brush machine)


The hardware abstraction layer is naturally a very important aspect of Android-both because it represents a disagreement with Linux and because it helps to support a large number of Android devices.

The Linux kernel

The Linux kernel provides excellent performance for Android * substrates due to its open source and free license nature.
Starting with the initial version of Linus Torvalds, the kernel continues to evolve at an alarming rate, adding new features every week or months.
The performance of Android's own kernel has been significantly affected, and notable examples are compressed RAM and 64-bit support. It takes kernel version 3.10 as the minimum version of Lollipop: The kernel officially supports ARM64 (AARCH64) starting from 3.7.
The Android kernel is compiled in a slightly different way from the Linux configuration file by merging the basics of Android and the recommended configuration template to generate those default kernel distribution versions (as shown in the Source.android.com Web site kernel))
Android brings its own traits or androidisms to the core. Some of the cores in these kernels are compiled by the #ifdef statement for conditional daemons, and the rest in the Drivers/staging/android directory.

Anonymous shared memory, Binder,logger,io memory allocator, low memory cleanup,

Ram Console (Kernel Panic find him, store dmsg log), drive sync, timed output, sleep Lock (power management)





Android INTERNALS.A First chapter

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.