news.

The wonder of Android

We have all heard of, or used an Android device but what makes Android so unique? According to market research firm IDC Android is currently the leader in the smartphone market with a 59% of the market compared to iOS with 29%. Android is an open source software stack for mobile devices such as smartphones and tablets. It consists of the Android operating system, the application framework and an application development toolkit assisting developers to create applications for the platform.

Android is designed to run on the advanced RISC Machine (ARM) architecture. ARM has a reduced instruction set computer (RISC)architecture where the instruction set is smaller and the instructions simpler compared to Intel’s complex instruction set computer (CISC) architecture.

The Android operating system is built on top of a modified Linux kernel. The Linux kernel is written in the C programming language and is easily ported to different platforms. It provides a layer of abstraction on top of its low level functionality such as process, memory, user, network and thread management. The Android kernel is extended to include the modules:

  • alarm manager
  • Ashmem – shared memory allocator
  • Binder – inter process communication (IPC) and remote procedure method invocation system
  • power management
  • low memory killer
  • a kernel debugger

to satisfy specific needs of mobile devices.

On top of the Android kernel is a set of native libraries written in C/C++ mostly borrowed from other open source projects. They provide the functionality such as:

  • database storage – SQLite
  • web browser engine – LibWebCore
  • the underlying 2D graphics engine – SGL

These native libraries also contain a custom, optimised version of the Java virtual machine (JVM) called the Dalvik virtual machine (DVM). The Dalvik VM is a register based VM as opposed to the Oracle JVM which is stack based. It is highly optimised to run dex bytecode on mobile devices with ARM RISC architecture.

The application framework is a collection of libraries written in Java. They are responsible for managing an application’s lifecycle as well providing an API with which the Android applications can interact. This API includes libraries to:

  • provide an interface that apps use to interact with the windowing system (window manager)
  • interact with the overall activities running in the system (activity manager)
  • provide a way to represent user interfaces and manage user input (view system)

Android applications are the programs with which users interact. They are developed by programmers on top of this Android application framework. Android applications are written in Java. Traditionally, Java applications are compiled to Java bytecode which is run on the Java Virtual Machine (JVM). Android applications are also compiled to Java bytecode, but, they are then further translated into dex bytecode which is executable on the Dalvik virtual machine.

For security reasons, each Android application is installed as a separate user on the operating system. Linux’s built in user management system then keeps applications from modifying the data and code of other applications. For even more security each application is run as a separate process. The applications can only interact using the binder IPC mechanism.

Android applications consist of four main components:

Activity – An Activity is a class responsible for representing and managing a user interface. An application can consist of many Activities.

The Android operating system has a static amount of memory available. When too many applications are running, and there is no more memory available, some components of the applications get killed. To keep track of which application components to kill the framework keeps an activity stack. An Activity gets placed on the top of this stack when it becomes the active Activity that is displayed on screen. Activities get killed from the bottom of this stack.

All the methods of an Activity are called from the main thread of the application. As a result processing can not be done in an activity as the user interface can become unresponsive during the processing. Another component called a Service is responsible for background processing.

Service – Performs background operations such as the pulling of messages from a server every 5 minutes. Services do not have user interfaces and an application can have zero or more services running simultaneously.

Content provider – Manages application data stored on the file system, in databases, on the web or other storage medium and provides a gateway to this data from other applications.

Broadcast receiver – Listens for and responds to system-wide events such as network failing, low battery or screen orientation change events.

These components interact with each other through Intents. Intents use   Binder IPC to send messages between components.  Binder IPC is a form of interprocess communication using shared memory to allow processes to interact with each other.

Intents are used to start Activities and Services or to provide a notification of certain events. They are similar to messages containing a description of an operation to be performed or, often in the case of broadcasts, a description of something that has happened and is being announced.

To develop for android is very simple as Google provides complete documentation on the framework including  development guides and  installation instructions at http://developer.android.com.

This post has only touched on some of the interesting aspects of Android, but Android is a very large mobile platform. It was developed to provide users with a simple interface that supports maximum functionality to allow users to perform complex tasks on devices with limited resources. That is why it is so amazing that Google decided to make this an open source project and basically give the platform away for free. Thank you Google!

Remember to look out for Google I/O live sessions starting on Wednesday 27 June!

No comments yet.

Leave a comment

Leave a Reply

(required)