Sie sind auf Seite 1von 20

Chapter 1 Introduction

1.1 General Android is a software stack for mobile devices that includes an operating system, middleware and application frame work. Each layer of the stack groups together several programs that support specific operating system functions. Android's mobile operating system is based on the Linux kernel. Android is the first environment that combines the following: A truly open, free development platform based on Linux and open source A component-based architecture inspired by Internet mash ups. Tons of built-in services out of the box Automatic management of the application life cycle High-quality graphics and sound Portability across a wide range of current and future hardware

Android offers a fresh take on the way mobile applications and interact with Users, along with the technical underpinnings to make it possible. But the best part of Android is the Software used by android can be written by anyone who knows JAVA programming well and that makes Android , swiftly emerging and developing technology ever. 1.2 History Android was first developed by Andy Rubin, Rich Miner, Nick Sears & Chris White in United States in October, 2003. It was acquired by Google in August, 2005. And now, Android is a wholly owned subsidiary of Google Inc. Android is an open source software toolkit for mobile phones that was Created by Google and the Open Handset Alliance. Its inside millions of Cell phones and other mobile devices, making Android a major platform for application developers. Open Handset Alliance was built from the ground-up to enable developers to create compelling mobile applications that take full advantage of all a handset has to offer and the association has now more than 73 companies in it, working for development of mobile operating services as an open handset. Some of them are LG, Samsung, HTC, Google, Linux, Intel, Sprint, Motorola, Java etc. HTC was the first company who delivered Android Operating System in their Mobile device as an OHA (Open Handset Alliance) .

1.3 Android Versions (Flavours) Android (1.0) B cone (1.1) Cupcake (1.5) Donut (1.6) Eclair (2.x) Froyo(2.2) Gingerbread (2.3x) Honeycomb (3.x) Ice-cream Sandwich (Expected to arrive in November, 2011)

1.4 Objective to study In todays world and in near future, Android is going to be developed as an emerging technology and so mobile devices having android operating systems can be viewed as multipurpose tools. For that a thorough study of android operating system and android application development is needed. 1.5 Future Scope of Work 1.5.1 Multi Touch Multi-touch is simply an extension of the regular touch-screen user Interface, using two or more fingers instead of one. Tap, drag, and a few other single-fingered gestures have always been supported in Android. However, because of the popularity of the Apple iPhone, early Android users suffered from a kind of gesture envy. Another better way is Pinch zoom. With pinch zoom, you place two fingers on the screen and squeeze them together to make the item youre viewing smaller, or you pull them apart to make it bigger. Before Android 2.0, you had to use a clunky zoom control with icons that you pressed to zoom in and out 1.5.2 Live Wall Papers Regular wallpaper just sits there. It looks nice, but it never changes. Live wallpaper is a new feature It lets you replace boring static wallpaper images with everything from vibrant and pulsing music visualizations to quiet, meditative ponds that respond to your touch with gentle ripples. Displaying current weather conditions, slide shows, Magic 8 Balls, and pyrotechnics are just a few of the ideas that are possible. The biggest challenge for one is to fetch the real time data from the web to your screen. This can be used for traffic controlling system and for many more applications.

Chapter 2 Architecture of Android Software Stack

Android's mobile operating system is based on the Linux kernel. Basic Architecture of Android stack is shown below. Android contains a layered architecture with five layers: Kernel, Android Libraries, Dalvik Virtual Machine and runtime, Application Framework and Android application. Basic Architecture is shown below :

Figure 2.1 Starting at the bottom is the Linux Kernel. Android uses Linux for its device drivers, memory management, process management, and networking. The next level up contains the Android native libraries. They are all written in C/C++ internally, but youll be calling them through Java interfaces. In this layer you can find the Surface Manager (for compositing windows), 2D and 3D graphics, Media codecs (MPEG-4, H.264, MP3, etc.), the SQL database (SQLite), and a native web browser engine (WebKit). Next is the Android runtime, including the Dalvik Virtual Machine. Dalvik runs dex files, which are coverted at compile time from standard classand jar files. Dex files are more compact and efficient than class files, an important consideration for the limited memory and battery powered devices that Android targets. The core Java libraries are also part of the Android runtime. They are written in

Java, as is everything above this layer. Here, Android provides a substantial subset of the Java 5 Standard Edition packages, including Collections, I/O, and so forth. The next level up is the Application Framework layer. Parts of this toolkit are provided by Google, and parts are extensions or services that you write. The most important component of the framework is the Activity Manager, which manages the life cycle of applications and a common back-stack for user navigation. Finally, the top layer is the Applications layer. Most of the code will live here, alongside built-in applications such as the Phone and Web Browser. One of the unique and powerful qualities of Android is that all applications have a level playing field. That is, the applications that Google writes have to go through the same public API that you use. You can even tell Android to make your application replace the standard applications if you like. The Android operating system is used on smartphones, netbooks, tablets, Google TV, and other devices The main hardware platform for Android is the ARM architecture. There is support for x86 from the Android-x86 project, and Google TV uses a special x86 version of Android. Further we will discuss about Memory management & Process Management in android in details.

Chapter 3 Detailed Study of Android Kernel


The base of the stack is the kernel. Google used the Linux version 2.6 OS to build Android's kernel, which includes Android's memory management programs, security settings, power management software and several hardware drivers Basically Android Kernel performs these tasks: Memory Management Process Management I/O handling / Drivers Networking

The two very important tasks Memory Management and Process Management is discussed here. 3.1 Memory Management Android memory management is a little unusual. Because, Android uses its own runtime and Dalvik Virtual Machine to manage application memory. Android Kernel ensures application responsiveness by stopping and killing processes as necessary to free resources for high priority applications. In android, processes cannot be quit. One cannot exit from any application. The state of the current running activity will be saved to the system process. Then you start some more apps, the memory management detects automatically if the free memory is to less and terminates old process automatically. Thats the reason why Android doesnt need a swap file and users must not close applications. Throughout the termination of the app process we get more memory resources and can start the new activity (process). Linux keeps an LRU (last recently used) list and starts killing the oldest unneeded process if memory needed. Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memory and process management to the Android run time, which stops and kills processes as necessary to manage resources. An another effect of the LRU is, that the user can go backwards. For sample: You read a mail and click a link. The browser will be opened. From the Browser there is a video link for YouTube. The YouTube app starts. Then the you tube video is

over you can go back with the backward buttons and you are really fast in your mail application back. The advantage is, that the closed apps while they are running in background doesnt need any CPU time and also so no battery power. But yes, they need memory resources. Technically, Each Android application runs in a separate process within its own Dalvik instance, relinquishing all responsibility for memory and process management to the Android run time, which stops and kills processes as necessary to manage resources. 3.2 Process Management This is needed when two applications with the same priority,comes into the picture. When both have the same priority, the process that has been at a lower priority longest will be killed first. Process priority is also affected by interprocess dependencies; if an application has a dependency on a Service or Content Provider supplied by a second application, the secondary application will have at least as high a priority as the application it supports.

All Android applications will remain running and in memory until the system needs its resources for other applications. Hierarchy of Processes according to their priority is given below.

Figure 3.1

Active Processes Active (foreground) processes are those hosting applications with components currently interacting with the user. These are the processes Android is trying to keep responsive by reclaiming resources. There are generally very few of these processes, and they will be killed only as a last resort. Visible Processes Visible, but inactive processes are those hosting visible Activities. As the name suggests, visible Activities are visible, but they arent in the foreground or responding to user events. This happens when an Activity is only partially obscured (by a non-full-screen or transparent Activity). There are

generally very few visible processes, and theyll only be killed in extreme circumstances to allow active processes to continue. Started Service Processes Processes hosting Services that have been started. Services support ongoing processing that should continue without a visible interface. Because Services dont interact directly with the user, they receive a slightly lower priority than visible Activities. Background Processes Processes hosting Activities that arent visible and that dont have any Services that have been started are considered background processes. There will generally be a large number of background processes that Android will kill using a last-seen-first-killed pat- tern to obtain resources for foreground processes. Empty Processes To improve overall system performance, Android often retains applications in memory after they have reached the end of their lifetimes. Android maintains this cache to improve the start-up time of applications when theyre re-launched. These processes are routinely killed as required. The Android OS does not work like a desktop operating system. On a desktop OS, like Windows, Mac OS X, or Ubuntu Linux, the user is responsible for closing programs in order to keep a reasonable amount of memory available. On Android, this is not the case. The OS itself automatically removes programs from memory as memory is needed. The OS may also preload applications into memory which it thinks might soon be needed. 3.3 Networking in Android The table shows some networking-related packages in the Android SDK with their activities.

java.net

Provides networking-related classes, including stream and datagram sockets, Internet Protocol, and generic HTTP handling. This is the multipurpose networking resource. Experienced Java developers can create applications right away with this familiar package. Though not explicitly networking, it's very important. Classes in this package are used by sockets and connections provided in other Java packages. They're also used for interacting with local files (a frequent occurrence when interacting with the network). Contains classes that represent buffers of specific data types. Handy for network communications between two Java language-based end points. Represents a number of packages that provide fine control and functions for HTTP communications. You might recognize Apache as the popular open source Web server.

java.io

java.nio

org.apache.*

android.net

Contains additional network access sockets beyond the core java.net.* classes. This package includes the URI class, which is used frequently in Android application development beyond traditional networking. Contains classes for manipulating SSL certificates. Contains classes for managing all aspects of WiFi (802.11 wireless Ethernet) on the Android platform. Not all devices are equipped with WiFi capability, particularly as Android makes headway in the "flipphone" strata of cell phones from manufacturers like Motorola and LG.

android.net.http android.net.wifi

android.telephony.gsm Contains classes required for managing and sending SMS (text) messages. Over time, an additional package will likely be introduced to provide similar functions on non-GSM networks, such as CDMA, or something like android.telephony.cdma. Table 3.1

3.4

I/O Handling and drivers

At the highest level, there is a need to port Android to devices which are not ARM-based, as other processors are prevalent in certain markets. Although porting to a new CPU is not too difficult, ensuring optimal operation of the entire Android software stack requires extensive work. For that Linux Kernel must be ported along with necessary board support components like device drivers.

For now, Android Kernel supports these drivers: Display Driver : Manages screen specifications Camera Driver : Manages Camera activity Flash Memory Driver : Manages Mass Storage IPC driver : Thread based communication manager This is how Android Kernel works.

Chapter 4 Detailed Study of Android Libraries


Native Libraries The next layer above the kernel contains the Android native libraries. These shared libraries are all written in C or C++, compiled for the particular hardware architecture used by the phone, and preinstalled by the phone vendor. Some of the most important native libraries include the following: Surface Manager: Android uses a compositing window manager similar to Vista or Compiz, but its much simpler. Instead of drawing directly to the screen buffer, your drawing commands go into off-screen bitmaps that are then combined with other bitmaps to form the display the user sees. This lets the system create all sorts of interesting effects such as see-through windows and fancy transitions. 2D and 3D graphics: Two- and three-dimensional elements can be combined in a single user interface with Android. The library will use 3D hardware if the device has it or a fast software renderer if it doesnt. Media codecs: Android can play video and record and play back audio in a variety of formats including AAC, AVC (H.264), H.263, MP3, and MPEG-4. SQL database: Android includes the lightweight SQLite database engine,2 the same database used in Firefox and the Apple iPhone. You can use this for persistent storage in your application. Browser engine: For the fast display of HTML content, Android uses the WebKit library.4 This is the same engine used in the Google Chrome browser, Apples Safari browser, the Apple iPhone, and Nokias S60 platform. These libraries are not applications that stand by themselves. They exist only to be called by higher-level programs. Starting in Android 1.5, you can write and deploy your own native libraries using the Native Development Toolkit (NDK).

10

Some Examples of Android Library Tools : AdWhirl is a free, open source tool that helps you make more money from your iPhone or Android app. It enables you to serve ads in your AdWhirl app from any number of ad networks as well as your own house ads. By using multiple networks, you can determine which perform best for you and optimize accordingly to maximize your revenue and fill all your inventory AGE is an open source, LGPL game engine for the Android platform that will push to streamline and standardize Android development for AGE games with a focus on performance, size, and modular design.

Mobile Maps provides developers with a simple way of adding map functionality to your mobile phone applications. It also includes access Mobile Maps to the map data itself, from either TeleAtlas or OpenStreetMap depending on which data suits your application needs. Table 4.1 And many more are available in Android Market for developers.

11

Chapter 5 Introduction to Dalvik Virtual Machine


Android Runtime also sitting on top of the kernel is the Android runtime, including the Dalvik virtual machine and the core Java libraries.

The Dalvik Virtual Machine Dalvik is a register-based virtual machine thats been optimized to ensure that a device can run multiple instances efficiently. It relies on the Linux kernel for threading and low-level memory management. One of the key elements of Android is the Dalvik virtual machine. Rather than use a traditional Java virtual machine (VM) such as Java ME (Java Mobile Edition), Android uses its own custom VM designed to ensure that multiple instances run efficiently on a single device. The Dalvik VM uses the devices underlying Linux kernel to handle low-level functionality including security, threading, and process and memory management. All Android hardware and system service access is managed using Dalvik as a middle tier. By using a VM to host application execution, developers have an abstraction layer that ensures they never have to worry about a particular hardware implementation. The Dalvik VM executes Dalvik executable files, a format optimized to ensure minimal memory foot- print. The .dex executables are created by transforming Java language compiled classes using the tools supplied within the SDK. The relative merits of stack machines versus register-based approaches : Generally, stack-based machines must use instructions to load data on the stack and manipulate that data, and, thus, require more instructions than register machines to implement the same high level code, but the instructions in a register machine must encode the source and destination registers and,

12

therefore, tend to be larger. This difference is primarily of importance to VM interpreters for which opcode dispatch tends to be expensive along with other factors similarly relevant to just-in-time compilation. A tool called dx is used to convert some (but not all) Java .class files into the .dex format. Multiple classes are included in a single .dex file. Duplicate strings and other constants used in multiple class files are included only once in the .dex output to conserve space. Java byte code is also converted into an alternative instruction set used by the Dalvik VM. An uncompressed .dex file is typically a few percent smaller in size than a compressed .jar (Java Archive) derived from the same .class files. The Dalvik executables may be modified again when installed onto a mobile device. In order to gain further optimizations, byte order may be swapped in certain data, simple data structures and function libraries may be linked inline, and empty class objects may be short-circuited, for example. As of Android 2.2, Dalvik has a just-in-time compiler. Being optimized for low memory requirements, Dalvik has some specific characteristics that differentiate it from other standard VMs:

The VM was slimmed down to use less space The constant pool has been modified to use only 32-bit indexes to simplify the interpreter Standard Java bytecode executes 8-bit stack instructions. Local variables must be copied to or from the operand stack by separate instructions. Dalvik instead uses its own 16-bit instruction set that works directly on local variables. The local variable is commonly picked by a 4-bit 'virtual register' field. This lowers Dalvik's instruction count and raises its interpreter speed.

Moreover, Dalvik has been designed so that a device can run multiple instances of the VM efficiently.

13

Chapter6 Application Framework and Android Application

6.1 Application Framework Sitting above the native libraries and runtime, youll find the Application Framework layer. This layer provides the high-level building blocks you will use to create your applications. The framework comes preinstalled with Android, but you can also extend it with your own components as needed. The most important parts of the framework are as follows: Activity Manager: This controls the life cycle of applications and maintains a common backstack for user navigation. Life Cycles : During its lifetime, each activity of an Android program can be in one of several states, as shown in Figure 6.1 :

Figure 6.1

14

onCreate(Bundle): This is called when the activity first starts up. You can use it to perform one-time initialization such as creating the user interface. onCreate( ) takes one parameter that is either null or some state information previously saved by the onSaveInstanceState() method. onStart( ): This indicates the activity is about to be displayed to the user. onResume( ): This is called when your activity can start interacting with the user. This is a good place to start animations and music. onPause( ): This runs when the activity is about to go into the background, usually because another activity has been launched in front of it. This is where you should save your programs persistent state, such as a database record being edited. onStop( ): This is called when your activity is no longer visible to the user and it wont be needed for a while. If memory is tight, onStop( ) may never be called (the system may simply terminate your process). THE BIG onRestart( ): If this method is called, it indicates your activity is being redisplayed to the user from a stopped state. onDestroy( ): This is called right before your activity is destroyed. If memory is tight, onDestroy( ) may never be called (the system may simply terminate your process). onSaveInstanceState(Bundle): Android will call this method to allow the activity to save per-instance state, such as a cursor position within a text field. Usually you wont need to override it because the default implementation saves the state for all your user interface controls automatically. onRestoreInstanceState(Bundle): This is called when the activity is being reinitialized from a state previously saved by the onSaveInstanceState( ) method. The default implementation restores the state of your user interface Building Blocks The most important ones are activities, intents,services, and content providers : Activities : An activity is a user interface screen. Applications can define one or more activities to handle different phases of the program. each activity is responsible for saving its own state so that it can be restored later as part of the application life cycle. An intent :

15

It is a mechanism for describing a specific action, such as pick a photo, phone home, or open the pod bay doors. In Android, just about everything goes through intents, so you have plenty of opportunities to replace or reuse components. For example, there is intent for send an email. If your application needs to send mail, you can invoke that intent. Or if youre writing a new email application, you can register an activity to handle that intent and replace the standard mail program. The next time somebody tries to send an email, theyll get the option to use your program instead of the standard one. Service : A service is a task that runs in the background without the users direct interaction, similar to a Unix daemon. For example, consider a music player. The music may be started by an activity, but you want it to keep playing even when the user has moved on to a different program. So, the code that does the actual playing should be in a service. Later, another activity may bind to that service and tell it to switch tracks or stop playing. Android comes with many services built in, along with convenient APIs to access them. Content Providers : A content provider is a set of data wrapped up in a custom API to read and write it. This is the best way to share global data between applications. For example, Google provides a content provider for contacts. All the information therenames, addresses, phone numbers, and so forthcan be shared by any application that wants to use it. Using Resources : A resource is a localized text string, bitmap, or other small piece of Non code information that your program needs. At build time all your resources get compiled into your application. This is useful for internationalization and for supporting multiple device types. You will create and store your resources in the res directory inside your project. The Android resource compiler (aapt) processes resources according to which subfolder they are in and the format of the file. For example, PNG and JPG format bitmaps should go in a directory starting with res/drawable, and XML files that describe screen layouts should go in a directory starting with res/layout. You can add suffixes for particular languages, screen orientations, pixel densities, and more. 6.2 Applications and Widgets : The highest layer in the Android architecture diagram is the Applications and Widgets layer. Think of this as the tip of the Android iceberg. End users will see only these programs, blissfully unaware of all the action going on below the waterline.

16

Applications are programs that can take over the whole screen and interact with the user. On the other hand, widgets (which are sometimes called gadgets), operate only in a small rectangle of the Home screen application. When someone buys an Android phone, it will come prepackaged with a number of standard system applications, including the following: Phone dialer Email Contacts Web browser Android Market

Using the Android Market, the user will be able to download new programs to run on their phone. Thats where All Android Consumers come in.

17

Chapter 7 Summary , Conclusion and Future Scope


7.1 Summary Android can be used as a perfect operating system, not only for mobile devices, but also for tablets, desktops , laptops and other Google devices, like chrome book or net book. Android is Open Handset Alliance and Being an open source, Android offers its developers, a new standard of expertise and skill. All the source codes written for any application is available for free, so one can easily make new applications, using the ones that already exist. Android Operating System has a layered architecture, which allows the beginners to learn the basic OS concepts easily. Android uses Linux Kernel, to provide the benefits of Memory Management, Process Management, Networking and Device Drivers handling. Android applications are written in Java language and based on the concept of pure Object Oriented Programming so; it uses the Core Java Libraries and classes from the packages of Java Development Kit. So, one must have these two concepts clear in his mind. For handling processes, Android uses its own Virtual Machine, Dalvik Virtual Machine, which has its own merits over the conventional register based methods. Android Application Framework gives the detailed information on how an Android application initiates and how it can be carried out further. Android applications are widely famous amongst the mobile markets. Android has emerged as the best open source applications provider all across the world. This is why android covers half of the market of the world wide mobile business There is a vast development of Android applications and even major developments are expected in fields like, Books, Business, Communication, Entertainment, Finance, Lifestyle , Health and Fitness, Shopping , Social , Productivity and Transportation. 7.2 Conclusions Android is a disruptive technology, which was introduced for mobile handsets, but has much wider potential. There are many challenges with the wider deployment of Android, but various companies are committed for supporting developers.

18

7.3 The future scope As the future scope of Android Applications, we can consider developing android as an embedded system. The use of multiple cores along with multiple operating systems will become increasingly common, as demands for high functionality and lower power consumption are reconciled. Android, like Linux, is not real time. Steps can be taken to make such an OS deterministic, but this approach has severe limitations. It is likely to have lower than required performance, and drivers, etc. may be incompatible with the needs of a real-time application. A better solution is to use a true, real-time operating system, to perform the real time activity for the system, while Android (or Linux) provides other functionality. Each type of OS may thus be used optimally: RTOS * Hard real time * Optimal on the data plane * Certified software stack Non-real time OS (Android/Linux) * User application framework * Massive middleware offering (ecosystem) * User interface Running multiple operating systems can be facilitated in a number of ways. Virtualization may be achieved using a hypervisor, which divides CPU time between the operating systems in a controlled way, giving each one apparent total control of the processor. This approach is complex and can have performance limitations, but may be attractive if legacy hardware is deployed. The use of multiple CPUs (cores on a chip or chips on a board) is increasingly attractive to system designers, as this permits optimization of power consumption. This provides the opportunity to simply run a different OS, as appropriate for the required functionality, on each CPU. So, one or more CPUs may be running Android/Linux and one or more others might run an RTOS.

There are already many mobile platforms on the market today, including Symbian, iPhone, Windows Mobile, BlackBerry, Java Mobile Edition, Linux Mobile (LiMo), and more but Android is the most developing platform because of this qualities.

19

20

Das könnte Ihnen auch gefallen