• Android Stack



    https://github.com/devacademy/android-fundamental-one/blob/master/modules/stack.md


    Android Stack

    As developers, our primary interest with Android is to develop apps. Before we dive into that, we will start with high level overview of Android Operating System stacks. Android OS consists of severel layers each with its own purposes.


    1. Linux

    Android is built on top of Linux. Linux is a great open source operating system. There are many good reasons for choosing Linux as the base of the Android stack. Linux is a mature project with lots of hardware abstraction related components are readily available. Linux is also a highly secure system, and all Android applications run as separate Linux processes with permissions set by the Linux system.

    Sandboxing

    Running each application as separate processes with different permissions is known as Sandboxing. Sandbox isolates your app data and code execution from other apps. One application cannot access data in another application sandbox without explicit permission.

    2. Native Libraries and Android Runtime

    Native Libraries

    The native libraries are C/C++ libraries, often taken from the open source community in order to provide necessary services to the Android application layer. Some of the libraries are:

    • Webkit A fast web-rendering engine used by Safari, Chrome, and other browsers
    • SQLite A full-featured SQL database
    • OpenGL 3D graphics libraries
    • OpenSSL The secure locket layer
    • And many others.

    Android Dalvik Virtual Machine

    Android use Java as primary programming language. Java compiles into bytecode and then executed on Java Virtual Machine (VM). By using Java VM, it is possible to execute Java code on every machine that runs Java VM without have to recompile the Java code.

    For Android, team at Google created new virtual machine named Dalvik designed specifically for mobile devices which has constraint on battery life and processing power. This makes compilation process a bit different from standard Java. After you created Java bytecode, you recompile it once again using the Dalvik compiler to Dalvik byte code. It is this Dalvik byte code that is then executed on the Dalvik VM.


    Dalvik is based on JIT (just in time) compilation. It means that each time you run an app, the part of the code required for its execution is going to be translated (compiled) to machine code at that moment. As you progress through the app, additional code is going to be compiled and cached, so that the system can reuse the code while the app is running. Since JIT compiles only a part of the code, it has a smaller memory footprint and uses less physical space on the device. However, there will be lag from the moment you click the app until its running.

    New Android Runtime

    As a part of Android 4.4 KitKat, Google introduced a new way of executing apps on top of the Android OS. Then new runtime, namedART (Android Runtime), compiles the Dalvik bytecode, into a system-dependent binary. The whole code of the app will be pre-compiled during install, called AOT (Ahead of Time) compilation. ART will generally make app execute mush faster. ART, however, increase the binary size of the app and takes a bit longer to install because of compilation process.

    Currently ART status is still ongoing project and experimental. In KitKat, You can choose to use ART by going toSettings > Developer Options > Select Runtime and choosing ART.


    3. Application Frameworks

    The application framewoks consists of numerous Java libraries specifically built for Android. This is the most important and the most extensively covered part of the Android platform because this is the layer that provide capabilities for app development such as location, WiFi, contacts, notification, messaging, telephony and so on.

    During this bootcamp, you will learn several Android frameworks used in Android app development. For more documentation on all of Android frameworks, you can checkAndroid developer website

    4. Applications

    At the top layer of Android stack is Applications or apps. these are the apps that you and other developers create. These apps are what end users find valuable about Android. They can come preinstalled on the device or can be downloaded from one of the many Android markets.


  • 相关阅读:
    省市区distpicker,从数据库里查出来回显,动态绑定
    ajax请求里面的success和error里面的layer.msg,status: "parsererror",刷新父界面,碰到的一些问题
    排序算法时间和空间算法度
    适配器模式
    守护线程
    工厂模式之简单工厂模式、工厂模式、抽象工厂
    ArrayList源码分析和缩减版手写ArrayList(jdk1.8和1.9)
    HashMap排序题
    二进制中1的个数
    anaconda指定镜像源,解决conda下载速度慢失败问题
  • 原文地址:https://www.cnblogs.com/ztguang/p/12644812.html
Copyright © 2020-2023  润新知