Key Components of Android

Android is designed to be different from other mobile platforms. As you've already learned, Android makes the best use of available resources by sharing those resources. But this doesn't just happen. The whole platform is designed so that sharable resources are available through the use of stacking. In the stacking method used to develop the Android platform, resources that are devoted specifically to the device reside at the bottom of the stack. Each progressive level above that becomes more sharable. Let's take a closer look at each level of the stack:

■ Linux kernel—The base of the Android stack is the Linux kernel. The Android Linux kernel is based on Linux Version 2.6. This kernel acts as the layer between the mobile-device hardware and the rest of the Android stack. It manages memory, processes, file systems, and all I/O operations.

Linux is a popular operating system that comes in many different flavors, built on top of the freely distributed Linux system kernel. Similar to an operating system on a computer providing an interface to the hardware, the Linux kernel in Android acts as an interface to your mobile devices.

■ Android runtime—On top of the Linux kernel is the Android runtime. Android includes a virtual machine called Dalvik that runs Java applications and is optimized for mobile devices to run with a low memory footprint and optimized hardware resource. Every Android application runs in its own process within a Dalvik virtual machine. The application is packaged into a Dalvik executable file that the Dalvik virtual machine executes.

A virtual machine is an environment on top of which your programs are executed. A virtual machine provides services such as memory management to executing programs. All compiled Java programs run on a byte-code interpreter, the Java Virtual Machine or JVM. Dalvik is the Android JVM.

The Android runtime is an environment (which includes the Dalvik virtual machine) for executing your Android applications.

The Android runtime also contains a set of core libraries that provide different functionality. You can access these functions when you're creating your own custom Android applications.

Core libraries are libraries that expose functions of a system. Referencing core libraries enables you to use the functions in your applications.

■ Libraries—The Android stack includes two sets of libraries. One set is core libraries that provide different functionality to the applications that run on Android. You can access these functions when creating your custom Android applications. These libraries help you include functionality in your applications that someone else has already created. This reduces the time spent on developing applications and can increase functionality because other developers continually improve the libraries.

The second set of libraries in the Android stack are native libraries developed using the C and C++ languages. This set includes support for different types of 2D and 3D media, a lightweight database, and so on. You do not access these libraries directly in your applications.

■ Application Framework—The C and C++ libraries in the Android stack are exposed to developers and other applications through the Application Framework. The Application Framework also enables applications to register functionality that the other applications can reuse.

The Application Framework provides a common set of core services that all applications can share. This includes services such as an activity manager to manage the life cycle of Android applications, a resource manager to manage application resources such as strings and images, and other services.

Application Framework is a common framework for developing your applications. It enables you to use many features that the Application Framework already provides, instead of having to start every application from scratch.

■ Applications—The Android stack ships with a basic set of applications. This includes an email client, short message service (SMS) client, calendar, browser, and contacts application. Part 2, "The Applications," covered these applications. If you skipped that part of the book, you can flip back at any time to learn more about how they work. Any custom application that you create also lives along with other applications in this part of the Android stack.

0 0

Post a comment