zoukankan      html  css  js  c++  java
  • 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.


  • 相关阅读:
    Python排列函数:sort、sorted
    Python高阶函数:map、reduece、filter
    Python:容器、迭代对象、迭代器、生成器及yield关键字
    JPA-映射-(@OneToOne)双向一对一
    JPA-映射-(@OneToMany、@ManyToOne)双向一对多
    JPA-映射-(@OneToMany)单向一对多
    JPA-映射-(@ManyToOne)单向多对一
    JPA-EntityManager.merge()
    JPA-API
    leetcode 2.Add Two Numbers
  • 原文地址:https://www.cnblogs.com/ztguang/p/12644812.html
Copyright © 2011-2022 走看看