Monday, 30 June 2014

Android Architecture

The main components of the Android architecture:

A.    Applications
B.     Application Framework
C.     Libraries
D.    Runtime Android
E.     Kernel – Linux
The following diagram shows the major components of the Android operating system.

Android architecture


A.  Applications:
An Android app lives in what’s called an APK, with a particular internal file layout that allows it to be run in place, without unpacking. The Android Manifest is the interface between an app and the Android system
These are applications written in Java. Some of basic applications include a calendar, email client, SMS program, maps, making phone calls, accessing the Web browser, accessing your contacts list and others. If you are an average user, this is the layer you will us most, rest all layers are used by Google programmers, developers and hardware manufacturers.
`


B.  Application Framework:
                        Developers have full access to the same framework APIs used by the core applications. The application architecture is designed to simplify the reuse of components; any application can publish its capabilities and any other application may then make use of those capabilities (subject to security constraints enforced by the framework). This same mechanism allows components to be replaced by the user.
                        Underlying all applications is a set of services and systems, including:
1.       rich and extensible set of Views that can be used to build an application, including lists, grids, text boxes, buttons, and even an embeddable web browser
2.       Content Providers that enable applications to access data from other applications (such as Contacts), or to share their own data
3.        Resource Manager, providing access to non-code resources such as localized strings, graphics, and layout files
4.       Notification Manager that enables all applications to display custom alerts in the status bar
5.       Activity Manager that manages the lifecycle of applications and provides a common navigation backstack.


                                         

C. Libraries:

                         Android includes a set of C/C++ libraries used by various components of the Android system. These capabilities are exposed to developers through the Android application framework. Some of the core libraries are listed below:
·         System C library - a BSD-derived implementation of the standard C system library (libc), tuned for embedded Linux-based devices
·         Media Libraries - based on PacketVideo's OpenCORE; the libraries support playback and recording of many popular audio and video formats, as well as static image files, including MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG
·         Surface Manager - manages access to the display subsystem and seamlessly composites 2D and 3D graphic layers from multiple applications
·         LibWebCore - a modern web browser engine which powers both the Android browser and an embeddable web view
·         SGL - the underlying 2D graphics engine
·         3D libraries - an implementation based on OpenGL ES 1.0 APIs; the libraries use either hardware 3D acceleration (where available) or the included, highly optimized 3D software rasterizer
·         FreeType - bitmap and vector font rendering
·         SQLite - a powerful and lightweight relational database engine available to all applications

D. Runtime Android:

            Android includes a set of core libraries that provides most of the functionality available in the core libraries of the Java programming language.
            Every Android application runs in its own process, with its own instance of the Dalvik virtual machine. Dalvik has been written so that a device can run multiple VMs efficiently. The Dalvik VM executes files in the Dalvik Executable (.dex) format which is optimized for minimal memory footprint. The VM is register-based, and runs classes compiled by a Java language compiler that have been transformed into the .dex format by the included "dx" tool.
            The Dalvik VM relies on the Linux kernel for underlying functionality such as threading and low-level memory management.
It’s possible, and common practice, to call back and forth between Dalvik and native code using the JNI protocol, which is a neat trick since what’s running on Dalvik isn’t anything like Java bytecodes on a Java VM.
The JNI protocol (Java Native Interface) A programming interface (API) in Sun's Java Virtual Machine used for calling native platform elements such as GUI routines. RNI (Raw Native Interface) is the JNI counterpart in Microsoft's Java Virtual Machine.

E. Kernel – Linux:
            This layer includes Android’s memory management programs, security settings, power management software and several drivers for hardware, file system access, networking and inter-process-communication. The kernel also acts as an abstraction layer between hardware and the rest of the software stack. Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model.
The Linux kernel is an operating system kernel used by the Linux family of Unix-like operating systems. It is one of the most prominent examples of free and open source software.
The Linux kernel is released under the GNU General Public License version 2 (GPLv2), (plus some firmware images with various licenses), and is developed by contributors worldwide. Day-to-day development takes place on the Linux kernel mailing list.
The Linux kernel was initially conceived and created by Finnish computer science student Linus Torvalds in 1991. Linux rapidly accumulated developers and users who adopted code from other free software projects for use with the new operating system. The Linux kernel has received contributions from thousands of programmers. Many Linux distributions have been released based upon the Linux kernel.
This layer includes Android’s memory management programs, security settings, power management software and several drivers for hardware, file system access, networking and inter-process-communication. The kernel also acts as an abstraction layer between hardware and the rest of the software stack. Android relies on Linux version 2.6 for core system services such as security, memory management, process management, network stack, and driver model.

Android GUI Architecture

Android GUI is single-threaded, event-driven and built on a library of nestable components. The Android UI framework is organized around the common Model-View-Controller pattern.
The Model : The model represents data or data container. You can see it as a database of pictures on your device. Say, any user wants to hear an audio file, he clicks play button and it triggers an event in your app,  now the app will get data from data store or database and as per input and creates data to be sent back to the user. You can refer this data as Model.
The View: The View is the portion of the application responsible for rendering the display, sending audio to speakers, generating tactile feedback, and so on.
            Now as per above example, the view in a hypothetical audio player might contain a component that shows the album cover for the currently playing tune. User will always interact with this layer. User action’s on this layer will trigger events that will go to the application functions.
The Controller: The Controller is the portion of an application that responds to external actions: a keystroke, a screen tap, an incoming call, etc. It is implemented as an event queue. On User’s action, the control is passed over to.



No comments:

Post a Comment