SL4A - Android Architecture
The Android software stack comprises of different layers, each layer manifesting well-defined behavior and providing specific services to the layer above it. The following figure presents a broad architecture of Android with its primary components.
Android is built on the Linux kernel code modified to run on embedded systems as against the traditional Linux system. Hardware drivers for many common devices are built into the kernel, thereby ensuring device portability. It is based on secure user based permission model, which prevents one application from reading another application’s information or from interfering with its execution (e.g. CPU, memory, devices etc.).
Group ID based access to networking and Bluetooth features, logger, alarm, power management, low memory killer, Binder IPC mechanisms are a few noted enhancements to the Kernel.
Libraries and Runtime
This forms the second layer of the architecture. It includes a set of hardware optimized C, C++ libraries, also referred to as the native layer. Examples include Media Libraries, SQLite, SSL, Bionic, WebKit etc.
The Android Runtime comprises of two different components − the Dalvik VM and Core Libraries. The Dalvik VM provides an execution environment for the applications on the Android Platform. The set of core libraries provides most of the functionality available in Java APIs.
This layer makes available the Libraries as services to the applications. Some most important components within this layer include Location Manager, Resource Manager, Activity Manager and Notification Manager.
By default, Android comes with a rich set of applications, including the browser, SMS program, calendar, contact manager, maps etc. Google Play provides alternatives to these applications, if the user desires so.
An application can interface with the system with four function blocks. They are as follows −
Activities − Activities represent a single screen that the user sees or interacts with visually. For example, an email app might have one activity that shows a list of new emails, another activity to compose an email, and another activity for reading emails.
Services − A majority of processing is done by these services for your application. It is the logic behind the user interface. For example, a service might play music in the background while the user is in a different app, or it might fetch data over the network without blocking user interaction with an activity.
Broadcast Receivers − A component that can be registered to listen for system or application events and issue notifications about the same. An instance for broadcast originating from the system is a ‘low battery notification’ while an application level broadcast could be a ‘download successful’ notification.
Content Providers − A content provider manages and helps you share data between multiple applications. For e.g. a content provider may be used to share the contacts data.
These components interact with each other through messages called Intents.