Linux Kernel

Published on February 2017 | Categories: Documents | Downloads: 38 | Comments: 0 | Views: 277
of 9
Download PDF   Embed   Report

Comments

Content

Linux kernel
At the bottom of the layers is Linux - Linux 2.6 with approximately 115 patches. This
provides basic system functionality like process management, memory
management, device management like camera, keypad, display etc. Also, the kernel
handles all the things that Linux is really good at such as networking and a vast
array of device drivers, which take the pain out of interfacing to peripheral
hardware.

Libraries
On top of Linux kernel there is a set of libraries including open-source Web browser
engine WebKit, well known library libc, SQLite database which is a useful repository
for storage and sharing of application data, libraries to play and record audio and
video, SSL libraries responsible for Internet security etc.

Android Runtime
This is the third section of the architecture and available on the second layer from
the bottom. This section provides a key component called Dalvik Virtual Machine
which is a kind of Java Virtual Machine specially designed and optimized for Android.

The Dalvik VM makes use of Linux core features like memory management and
multi-threading, which is intrinsic in the Java language. The Dalvik VM enables every
Android application to run in its own process, with its own instance of the Dalvik
virtual machine.

The Android runtime also provides a set of core libraries which enable Android
application developers to write Android applications using standard Java
programming language.

Application Framework
The Application Framework layer provides many higher-level services to applications
in the form of Java classes. Application developers are allowed to make use of these
services in their applications.

Applications
You will find all the Android application at the top layer. You will write your
application to be installed on this layer only. Examples of such applications are
Contacts Books, Browser, Games etc.

1. Linux Kernel
The basic layer is the Linux Kernel. The whole Android OS is built on
top of the Linux Kernel with some further architectural changes.
Please don’t get confused by the terms Linux and Linux Kernel. The
term Kernel means the core of any Operating System. By saying
Android is based upon Linux Kernel, it doesn’t mean that it is
another Linux distribution. It is not like that. It simply means,
Android at its core is Linux. But you can’t run any linux packages on
Android. It is a totally different OS. It is this Linux kernel that
interacts with the hardware and it contains all the essential
hardware drivers. Drivers are programs that control and
communicate with the hardware. For example, consider the
Bluetooth function. All devices has a Bluetooth hardware in it.
Therefore the kernel must include a Bluetooth driver to
communicate with the Bluetooth hardware. The Linux kernel also
acts as an abstraction layer between the hardware and other
software layers. As the Android is built on a most popular and
proven foundation, the porting of Android to variety of hardware
became a relatively painless task.

2. Libraries
The next layer is the Android’s native libraries. It is this layer that
enables the device to handle different types of data. These libraries
are written in c or c++ language and are specific for a particular
hardware.

Some of the important native libraries include the following:
Surface Manager: It is used for compositing window manager with

off-screen buffering. Off-screen buffering means the apps can’t
directly draw into the screen, instead the drawings go to the offscreen buffer. There it is combined with other drawings and form the
final screen the user will see. This off screen buffer is the reason
behind the transparency of windows.
Media framework: Media framework provides different media codecs

allowing the recording and playback of different media formats
SQLite: SQLite is the database engine used in android for data

storage purposes
WebKit: It is the browser engine used to display HTML content
OpenGL: Used to render 2D or 3D graphics content to the screen

3. Android Runtime
Android Runtime consists of Dalvik Virtual machine and Core Java
libraries.

Dalvik Virtual Machine
It is a type of JVM used in android devices to run apps and is
optimized for low processing power and low memory environments.
Unlike the JVM, the Dalvik Virtual Machine doesn’t run .class files,
instead it runs .dex files. .dex files are built from .class file at the
time of compilation and provides hifger efficiency in low resource
environments. The Dalvik VM allows multiple instance of Virtual
machine to be created simultaneously providing security, isolation,
memory management and threading support.

ART

Google has introduced a new virtual machine known as ART (Android
Runtime) in their newer releases of Android. In Lollipop, the Dalvik
Virtual Machine is completely replaced by ART. ART has many
advantages over Dalvik VM such as AOT (Ahead Of Time)
compilation and improved garbage collection which boost the
performance of apps significantly.

Core Java Libraries
These are different from Java SE and Java ME libraries. However
these libraries provides most of the functionalities defined in the
Java SE libraries.

4. Application Framework
These are the blocks that our applications directly interacts with.
These programs manage the basic functions of phone like resource
management, voice call management etc. As a developer, you just
consider these are some basic tools with which we are building our
applications.
Important blocks of Application framework are:
Activity Manager: Manages the activity life cycle of applications
Content Providers: Manage the data sharing between applications
Telephony Manager: Manages all voice calls. We use telephony

manager if we want to access voice calls in our application.
Location Manager: Location management, using GPS or cell tower
Resource Manager: Manage the various types of resources we use in

our Application

5. Applications

Applications are the top layer in the Android architecture and this is
where our applications are gonna fit into. Several standard
applications comes pre-installed with every device, such as:


SMS client app



Dialer



Web browser



Contact manager
As a developer we are able to write an app which replace any
existing system app. That is, you are not limited in accessing any
particular feature. You are practically limitless and can whatever you
want to do with the android (as long as the users of your app
permits it). Thus Android is opening endless opportunities to the
developer.

The Linux Kernel

Positioned at the bottom of the Android software stack, the Linux Kernel provides a
level of abstraction between the device hardware and the upper layers of the
Android software stack. Based on Linux version 2.6, the kernel provides preemptive
multitasking, low-level core system services such as memory, process and power
management in addition to providing a network stack and device drivers for
hardware such as the device display, Wi-Fi and audio.
The original Linux kernel was developed in 1991 by Linus Torvalds and was
combined with a set of tools, utilities and compilers developed by Richard Stallman

at the Free Software Foundation to create a full operating system referred to as
GNU/Linux. Various Linux distributions have been derived from these basic
underpinnings such as Ubuntu and Red Hat Enterprise Linux.
It is important to note, however, that Android only uses the Linux kernel. That said,
it is worth noting that the Linux kernel was originally developed for use in traditional
computers in the form of desktops and servers. In fact, Linux is now most widely
deployed in mission critical enterprise server environments. It is a testament to
both the power of today’s mobile devices and the efficiency and performance of the
Linux kernel that we find this software at the heart of the Android software stack.
Android Runtime - Dalvik Virtual Machine

As previously noted, the Linux kernel provides a multitasking execution environment
allowing multiple processes to execute concurrently. It would be easy to assume,
therefore, that each Android application simply runs as a process directly on the
Linux kernel. In fact, each application running on an Android device does so within
its own instance of the Dalvik virtual machine (VM).
Running applications in virtual machines provides a number of advantages. Firstly,
applications are essentially sandboxed, in that they cannot detrimentally interfere
(intentionally or otherwise) with the operating system or other applications, nor can
they directly access the device hardware. Secondly, this enforced level of
abstraction makes applications platform neutral in that they are never tied to any
specific hardware.
The Dalvik virtual machine was developed by Google and relies on the underlying
Linux kernel for low-level functionality. It is more efficient than the standard Java VM
in terms of memory usage, and specifically designed to allow multiple instances to
run efficiently within the resource constraints of a mobile device.
In order to execute within a Dalvik VM, application code must be transformed from
standard Java class files to the Dalvik executable (.dex) format, which has a 50%
smaller memory footprint than standard Java bytecode. Standard Java class files can
usually (though not always) be converted to Dex format using the dx tool included
with the Android SDK.
Android Runtime – Core Libraries

The Android Core Libraries (also referred to as the Dalvik Libraries) fall into three
main categories, each of which merits an individual description:
Dalvik VM Specific Libraries
This is a set of libraries used predominantly for interacting directly with an instance
of the Dalvik VM and is unlikely to be used by most Android application developers.

eBookFrenzy.com
Purchase the full edition of this Android 4.4 App Development Essentials publication
in eBook ($9.99) or Print ($28.99) format
Android 4.4 App Development Essentials Print and eBook (ePub/PDF/Kindle) editions
contain 52 chapters.
Buy eBook
Buy Print

Java Interoperability Libraries
Android applications are predominantly developed using the Java programming
language. The Standard Java development environment includes a vast array of
classes that are contained in the core Java runtime libraries. These libraries provide
support for tasks such as string handling, networking and file manipulation (to name
but a few) and are both familiar to, and widely used by Java developers regardless
of platform.
The Java Interoperability Libraries are an open source implementation (based on the
Apache Harmony project) of a subset of the Standard Java core libraries that have
been adapted and transformed for use by applications running within a Dalvik VM.
Android Libraries
This category encompasses those Java-based libraries that are specific to Android
development. Examples of libraries in this category include the application
framework libraries in addition to those that facilitate user interface building,
graphics drawing and database access.
A summary of some key core Android libraries available to the Android developer is
as follows:
android.app – Provides access to the application model and is the cornerstone of all
Android applications.
android.content – Facilitates content access, publishing and messaging between
applications and application components.
android.database – Used to access data published by content providers and includes
SQLite database management classes.
android.graphics – A low-level 2D graphics drawing API including colors, points,
filters, rectangles and canvases.
android.hardware – Presents an API providing access to hardware such as the
accelerometer and light sensor.
android.opengl – A Java interface to the OpenGL ES 3D graphics rendering API.

android.os – Provides applications with access to standard operating system
services including messages, system services and inter-process communication.
android.media – Provides classes to enable playback of audio and video.
android.net – A set of APIs providing access to the network stack. Includes
android.net.wifi, which provides access to the device’s wireless stack.
android.provider – A set of convenience classes that provide access to standard
Android content provider databases such as those maintained by the calendar and
contact applications.
android.text – Used to render and manipulate text on a device display.
android.util – A set of utility classes for performing tasks such as string and number
conversion, XML handling and date and time manipulation.
android.view – The fundamental building blocks of application user interfaces.
android.widget - A rich collection of pre-built user interface components such as
buttons, labels, list views, layout managers, radio buttons etc.
android.webkit – A set of classes intended to allow web-browsing capabilities to be
built into applications.
Having covered the Java-based core libraries in the Android runtime, it is now time
to turn our attention to the C/C++ based libraries contained in this layer of the
Android software stack.
C/C++ Libraries
The Android runtime core libraries outlined in the preceding section are Java-based
and provide the primary APIs for developers writing Android applications. It is
important to note, however, that the core libraries do not actually perform much of
the actual work and are, in fact, essentially Java “wrappers” around a set of C/C++
based libraries. When making calls, for example, to the android.opengl library to
draw 3D graphics on the device display, the library actually ultimately makes calls
to the OpenGL ES C++ library which, in turn, works with the underlying Linux kernel
to perform the drawing tasks.
C/C++ libraries are included to fulfill a wide and diverse range of functions including
2D and 3D graphics drawing, Secure Sockets Layer (SSL) communication, SQLite
database management, audio and video playback, bitmap and vector font
rendering, display subsystem and graphic layer management and an
implementation of the standard C system library (libc).
In practice, the typical Android application developer will access these libraries
solely through the Java based Android core library APIs. In the event that direct
access to these libraries is needed, this can be achieved using the Android Native
Development Kit (NDK), the purpose of which is to call the native methods of nonJava programming languages (such as C and C++) from within Java code using the
Java Native Interface (JNI).

Application Framework

The Application Framework is a set of services that collectively form the
environment in which Android applications run and are managed. This framework
implements the concept that Android applications are constructed from reusable,
interchangeable and replaceable components. This concept is taken a step further
in that an application is also able to publish its capabilities along with any
corresponding data so that they can be found and reused by other applications.
The Android framework includes the following key services:
Activity Manager – Controls all aspects of the application lifecycle and activity stack.
Content Providers – Allows applications to publish and share data with other
applications.
Resource Manager – Provides access to non-code embedded resources such as
strings, color settings and user interface layouts.
Notifications Manager – Allows applications to display alerts and notifications to the
user.
View System – An extensible set of views used to create application user interfaces.
Package Manager – The system by which applications are able to find out
information about other applications currently installed on the device.
Telephony Manager – Provides information to the application about the telephony
services available on the device such as status and subscriber information.
Location Manager – Provides access to the location services allowing an application
to receive updates about location changes.
Applications

Located at the top of the Android software stack are the applications. These
comprise both the native applications provided with the particular Android
implementation (for example web browser and email applications) and the third
party applications installed by the user after purchasing the device.

Sponsor Documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close