| page.title=Platform Architecture |
| page.keywords=platform,architecture,framework |
| @jd:body |
| |
| |
| <div id="qv-wrapper"> |
| <div id="qv"> |
| <h2> |
| In this document |
| </h2> |
| |
| <ol> |
| <li> |
| <a href="#linux-kernel">The Linux Kernel</a> |
| </li> |
| |
| <li> |
| <a href="#hal">Hardware Abstraction Layer (HAL)</a> |
| </li> |
| |
| <li> |
| <a href="#art">Android Runtime</a> |
| </li> |
| |
| <li> |
| <a href="#native-libs">Native C/C++ Libraries</a> |
| </li> |
| |
| <li> |
| <a href="#api-framework">Java API Framework</a> |
| </li> |
| |
| <li> |
| <a href="#system-apps">System Apps</a> |
| </li> |
| </ol> |
| </div> |
| </div> |
| |
| <p> |
| Android is an open source, Linux-based software stack created for a wide |
| array of devices and form factors. The following diagram shows the major |
| components of the Android platform. |
| </p> |
| |
| <img src="/guide/platform/images/android-stack_2x.png" alt="" width= |
| "519"> |
| <p class="img-caption"> |
| <strong>Figure 1.</strong> The Android software stack. |
| </p> |
| |
| <h2 id="linux-kernel"> |
| The Linux Kernel |
| </h2> |
| |
| <p> |
| The foundation of the Android platform is the Linux kernel. For example, |
| <a href="#art">the Android Runtime (ART)</a> relies on the Linux kernel for |
| underlying functionalities such as threading and low-level memory management. |
| </p> |
| |
| <p> |
| Using a Linux kernel allows Android to take advantage of <a href= |
| "https://source.android.com/security/overview/kernel-security.html">key |
| security features</a> and allows device manufacturers to develop hardware |
| drivers for a well-known kernel. |
| </p> |
| |
| <h2 id="hal"> |
| Hardware Abstraction Layer (HAL) |
| </h2> |
| |
| <p> |
| The <a href= |
| "https://source.android.com/devices/index.html#Hardware%20Abstraction%20Layer"> |
| hardware abstraction layer (HAL)</a> provides standard interfaces that expose |
| device hardware capabilities to the higher-level <a href= |
| "#api-framework">Java API framework</a>. The HAL consists of multiple library |
| modules, each of which implements an interface for a specific type of hardware |
| component, such as the <a href= |
| "https://source.android.com/devices/camera/index.html">camera</a> or <a href= |
| "https://source.android.com/devices/bluetooth.html">bluetooth</a> module. |
| When a framework API makes a call to access device hardware, the Android |
| system loads the library module for that hardware component. |
| </p> |
| |
| <h2 id="art"> |
| Android Runtime |
| </h2> |
| |
| <p> |
| For devices running Android version 5.0 (API level 21) or higher, each app |
| runs in its own process and with its own instance of the <a href= |
| "http://source.android.com/devices/tech/dalvik/index.html">Android Runtime |
| (ART)</a>. ART is written to run multiple virtual machines on low-memory |
| devices by executing DEX files, a bytecode format designed specially for |
| Android that's optimized for minimal memory footprint. Build toolchains, such |
| as <a href="https://source.android.com/source/jack.html">Jack</a>, compile |
| Java sources into DEX bytecode, which can run on the Android platform. |
| </p> |
| |
| <p> |
| Some of the major features of ART include the following: |
| </p> |
| |
| <ul> |
| <li>Ahead-of-time (AOT) and just-in-time (JIT) compilation |
| </li> |
| |
| <li>Optimized garbage collection (GC) |
| </li> |
| |
| <li>Better debugging support, including a dedicated sampling profiler, |
| detailed diagnostic exceptions and crash reporting, and the ability to set |
| watchpoints to monitor specific fields |
| </li> |
| </ul> |
| |
| <p> |
| Prior to Android version 5.0 (API level 21), Dalvik was the Android runtime. |
| If your app runs well on ART, then it should work on Dalvik as well, but |
| <a href="/guide/platform/verifying-apps-art.html">the reverse may not be |
| true</a>. |
| </p> |
| |
| <p> |
| Android also includes a set of core runtime libraries that provide most of |
| the functionality of the Java programming language, including some <a href= |
| "/guide/platform/j8-jack.html">Java 8 language features</a>, that the Java |
| API framework uses. |
| </p> |
| |
| <h2 id="native-libs"> |
| Native C/C++ Libraries |
| </h2> |
| |
| <p> |
| Many core Android system components and services, such as ART and HAL, are |
| built from native code that require native libraries written in C and C++. |
| The Android platform provides Java framework APIs to expose the functionality |
| of some of these native libraries to apps. For example, you can access |
| <a href="/guide/topics/graphics/opengl.html">OpenGL ES</a> through the |
| Android framework’s <a href= |
| "/reference/android/opengl/package-summary.html">Java OpenGL API</a> to add |
| support for drawing and manipulating 2D and 3D graphics in your app. |
| </p> |
| |
| <p> |
| If you are developing an app that requires C or C++ code, you can use the |
| <a href="/ndk/index.html">Android NDK</a> to access some of these <a href= |
| "/ndk/guides/stable_apis.html">native platform libraries</a> directly from |
| your native code. |
| </p> |
| |
| <h2 id="api-framework"> |
| Java API Framework |
| </h2> |
| |
| <p> |
| The entire feature-set of the Android OS is available to you through APIs |
| written in the Java language. These APIs form the building blocks you need to |
| create Android apps by simplifying the reuse of core, modular system |
| components and services, which include the following: |
| </p> |
| |
| <ul> |
| <li>A rich and extensible <a href="/guide/topics/ui/overview.html">View |
| System</a> you can use to build an app’s UI, including lists, grids, text |
| boxes, buttons, and even an embeddable web browser |
| </li> |
| |
| <li>A <a href="/guide/topics/resources/overview.html">Resource Manager</a>, |
| providing access to non-code resources such as localized strings, graphics, |
| and layout files |
| </li> |
| |
| <li>A <a href="/guide/topics/ui/notifiers/notifications.html">Notification |
| Manager</a> that enables all apps to display custom alerts in the status bar |
| </li> |
| |
| <li>An <a href="/guide/components/activities.html">Activity Manager</a> that |
| manages the lifecycle of apps and provides a common <a href= |
| "/guide/components/tasks-and-back-stack.html">navigation back stack</a> |
| </li> |
| |
| <li> |
| <a href="/guide/topics/providers/content-providers.html">Content |
| Providers</a> that enable apps to access data from other apps, such as |
| the Contacts app, or to share their own data |
| </li> |
| </ul> |
| |
| <p> |
| Developers have full access to the same <a href= |
| "/reference/packages.html">framework APIs</a> that Android system apps use. |
| </p> |
| |
| <h2 id="system-apps"> |
| System Apps |
| </h2> |
| |
| <p> |
| Android comes with a set of core apps for email, SMS messaging, calendars, |
| internet browsing, contacts, and more. Apps included with the platform have |
| no special status among the apps the user chooses to install. So a |
| third-party app can become the user's default web browser, SMS messenger, or |
| even the default keyboard (some exceptions apply, such as the system's |
| Settings app). |
| </p> |
| |
| <p> |
| The system apps function both as apps for users and to provide key |
| capabilities that developers can access from their own app. For example, if |
| your app would like to deliver an SMS message, you don't need to build that |
| functionality yourself—you can instead invoke whichever SMS app is already |
| installed to deliver a message to the recipient you specify. |
| </p> |