Android

Android OS
Android operating system is a stack of software components comprising of
  • Linux kernel
  • Native libraries
  • Android Runtime
  • Application Framework
  • Applications
Each layer of the stack, and the corresponding elements within each layer, are tightly integrated and carefully tuned to provide the optimal application development and execution environment for mobile devices. The architecture is as below:
Linux kernel
The Linux Kernel is the heart of android architecture. Android was created on the open source kernel of Linux. One main reason for choosing this kernel was that it provided proven core features on which to develop the Android operating system.
It provides preemptive multitasking, low-level core system services such as memory management, process management and power management in addition to providing a network stack for network communication and device drivers for hardware such as the device display, Wi-Fi and audio. The kernel also handles the security between the application and the system.
Android Libraries
On top of Linux kernel there is a set of Native libraries specific to Android development, including open-source Web browser engine WebKit, C runtime library libc, FreeType for font support, Media Library to play and record audio and video, SQLite database which is a useful repository for storage and sharing of application data, SSL libraries responsible for Internet security etc. A summary of some key core Android libraries available to the Android developer is as below
  • app − Provides access to the application model and is the cornerstone of all Android applications.
  • content − Facilitates content access, publishing and messaging between applications and application components.
  • database − Used to access data published by content providers and includes SQLite database management classes.
  • graphics– A low-level 2D graphics drawing API including colors, points, filters, rectangles and canvases.
  • hardware– Presents an API providing access to hardware such as the accelerometer and light sensor.
  • opengl − A Java interface to the OpenGL ES 3D graphics rendering API.
  • os − Provides applications with access to standard operating system services including messages, system services and inter-process communication.
  • media– Provides classes to enable playback of audio and video.
  • net – A set of APIs providing access to the network stack. Includes android.net.wifi, which provides access to the device’s wireless stack.
  • print– Includes a set of classes that enable content to be sent to configured printers from within Android applications.
  • 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.
  • text − Used to render and manipulate text on a device display.
  • util– A set of utility classes for performing tasks such as string and number conversion, XML handling and date and time manipulation.
  • view– The fundamental building blocks of application user interfaces.
  • widget – A rich collection of pre-built user interface components such as buttons, labels, list views, layout managers, radio buttons etc.
  • webkit– A set of classes intended to allow web-browsing capabilities to be built into applications.
C/C++ Libraries
The Android runtime core libraries are Java-based and provide the primary APIs for developers writing Android applications. But the core libraries do not perform much of the actual work and are, essentially Java “wrappers” around a set of C/C++ based libraries.
For example – When making calls to the android.opengl library to draw 3D graphics on the device display, the library actually 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).
Android Runtime
When an Android app is built within Android Studio it is compiled into an intermediate bytecode format (referred to as DEX format). When the application is subsequently loaded onto the device, the Android Runtime (ART) uses a process referred to as Ahead-of-Time (AOT) compilation to translate the bytecode down to the native instructions required by the device processor. This format is known as Executable and Linkable Format (ELF). Each time the application is subsequently launched, the ELF executable version is run, resulting in faster application performance and improved battery life. The key component of the Android runtime is the Dalvik Virtual Machine. It acts like Java Virtual Machine and is specially designed and optimized for Android to ensure that multiple instances run efficiently on a single device.
The Dalvik VM uses the device’s underlying Linux kernel to handle low-level functionality, including security, threading and memory management. It consumes less memory and provides fast performance.
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 is a set of services that collectively form the environment in which Android applications run and are managed. This framework includes Android API’s such as UI (User Interface), telephony, resources, locations, Content Providers (data) and package managers. It provides a lot of classes and interfaces for android application development. 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
The Applications are located at the top of the Android software stack. These comprise both the native applications provided with the particular Android implementation (for example web browser, Contacts Books, email applications, etc.) and the third–party applications installed by the user after purchasing the device. All applications use the Android runtime and libraries which in turn uses the Linux kernel.