mike cleron: hi. my name is mike cleron. i'm an engineer on the androiddevelopment team. android is an open softwareplatform for mobile development.
Android kernel version, it is intended to be a completestack that includes everything from the operatingsystem through middleware and up through applications. in the next few minutes, i'mgoing to be introducing you to
an overview of the architectureof the android platform, and i'm also going totalk about some of the key principles that are underlyingits design. if we're going to talk aboutarchitecture, we need to start with a diagram coveredwith a lot of little boxes, and this is ours. we're going to start atthe bottom, work up. our architecture is basedon the linux 2.6 kernel. we used the linux kernel as our
hardware abstraction layer. so if you are an oem trying tobring up android on a new device, the first thing you'ddo is bring up linux and get all your drivers in place. the reason we're using linuxis because it provides a proven driver model,and in a lot of cases, existing drivers. it also provides memorymanagement, process management, a security model,networking, a lot of core
operating system infrastructuresthat are robust and have beenproven over time. the next level up is ournative libraries. everything that you seehere in green is written in c and c++. it's at this level where a lotof the core power of the android platform comes from. i'm just going to go throughand describe what some of these components are.
i'm going to start withthe surface manager. the surface manager isresponsible for composing different drawing surfacesonto the screen. so it's the surface managerthat's responsible for taking different windows that areowned by different applications that are running indifferent processes and all drawing at different times andmaking sure the pixels end up on the screen when they'resupposed to. below that, we have two boxes.
opengl es and sgl, and thesetwo make up the core of our graphics libraries. opengl es is a 3d library. we have a softwareimplementation that is hardware accelerateable if thedevice has a 3d chip on it. the sgl graphics are for 2dgraphics, and that is what most of our applicationdrawing is based on. one interesting thing about theandroid graphics platform is that you can combine 3d and2d graphics in the same
application. moving over, we have themedia framework. the media framework was providedby packetvideo, one of the members of the openhandset alliance, and that contains all of the codecs thatmake up the core of the media experience. so in there, you'll find mpeg-4,h.264, mp3, aac, all the audio and video codecs youneed to build a rich media experience.
we use freetype torender our fonts. we have an implementationof sqlite. we use that as the core ofmost of our data storage. we have webkit which is the opensource browser engine. that's what we're using asthe core of our browser. it's the same browser that'spowering safari from apple. and we've worked with thatengine to make it render well on small screens andon mobile devices. next is the android runtime, andthe main component in the
android runtime is the dalvikvirtual machine. the android runtime was designedspecifically for android to meet the needs ofrunning in an embedded environment where you havelimited battery, limited memory, limited cpu. the dalvik virtual machineruns something called dex files, dot d-e-x. and these arebyte codes that are the results of converting,at build time, .class and .jar files.
so these files, when they areconverted to .dex, become a much more efficient byte codethat can run very well on small processors. they use memory veryefficiently, the data structures are designed to beshared across processes whenever possible, and it usesa highly cpu optimized byte code interpreter. the end result of that is thatit's possible to have multiple instances of the dalvik virtualmachine running on the
device at the same time, one ineach of several processes. and we'll see why that'simportant a little bit later on. the next level up from thatis the core libraries. this is in blue, meaning thatit's written in the java programming language. and the core library containsall of the collection classes, utilities, i/o, all theutilities and tools that you've come to expect to use.
moving up again, we now havethe application framework. this is all written in the javaprogramming language, and the application frameworkis the tool kit that all applications use. these applications include theones that come with a phone, like the home application orthe phone application. it includes applications writtenby google and it includes applications thatwill be written by you. so all applications usethe same framework
and the same apis. again, i'm going to go throughand talk about what some of the main components arein this layer in the application framework. the activity manager is whatmanages the life cycle of applications. it also maintains a commonback stack so that applications that are runningin different processes can have a smoothly integratednavigation experience.
next down from that isthe package manager. the package manager is whatkeeps track of which applications are installedon your device. so if you download newapplications over the air or otherwise install applications,it's the package manager that's responsible forkeeping track of what you have and what the capabilities ofeach of your applications are. the window managermanages windows. it's mostly a java programminglanguage abstraction on top of
lower level servicesthat are provided by the surface manager. the telephony manager containsthe apis that we use to build the phone application that'scentral to the phone content providers are a uniquepiece of the android platform. that's a framework that allowsapplications to share their data with other applications. we use that in our contactsapplication so that all of the information in contacts--
phone numbers, addresses,names-- is available to any applicationthat wants to make use of them. and other applications canuse that facility as well to share data. the resource manager is whatwe use to store localized strings, bitmaps, layout filedescriptions, all of the external parts in an applicationthat aren't code. i'm just going to touch lightlyon the remaining four
boxes, view system, locationmanager, notification manager, and xmpp service. the view system contains thingslike buttons and lists, all the building blocksof the ui. it also handles thingslike event dispatching, layout, drawing. location manager, notificationmanager, and xmpp service are some apis that i think willallow developers to create really innovative and excitingapplications.
and the final layer ontop is applications. this is where all theapplications get written. it includes the homeapplication, the contacts application, the browser,your applications. and everything at this layeris, again, using the same application framework providedby the layers below. now, if you're going to write anapplication, the first step is to decompose it into thecomponents that are supported by the android platform.
here are the four major ones. we have activity,intentreceiver, service, and contentprovider. an activity is essentially justa piece of ui, typically corresponding to one screen. so if you think of somethinglike the mail application, that would be decomposed intomaybe three major activities, something that lists your mail,something that shows you what an individual mail messageand a compose screen
to put together anoutgoing email. an intentreceiver is somethingdifferent. an intentreceiver is a way forwhich your application to register some code that won'tbe running until it's triggered by someexternal event. and the set of external eventsthat triggers your code is open and extensible. so you can write some code and,through xml, register it to be woken up and run whensomething happens, when the
network connectivity isestablished, or at a certain time, or when the phone rings,or whatever trigger make sense for your application. the next major componentis a service. a service is a task that doesn'thave any ui, that's long-lived, that's runningin the background. a good example isa music player. you may start playing some musicfrom an activity, from a piece of ui, but once the musicis playing, you'd want
it to keep playing even ifyou're navigating to other parts of the user experience. so the code that's actuallyrunning through the playlist playing songs wouldbe a service. that's running inthe background. you can connect to it later ifyou want to from an activity or some other component bybinding to the service and sending it messages like skipto the next song or rewind. the last component is acontentprovider, and again,
that's a component that allowsyou to share some of your data with other processes andother applications. now, any application can storedata in whatever way makes sense for that application. they can store it in files,they can store it in our sqlite database, whatevermakes sense. but if they want to make thatdata available as part of a platform so that otherapplications can make use of it, then the contentprovideris a solution for that.
and we've used that for thecontacts database that comes with the android platform sothat any application can make use of the informationin contacts. android was designed at afundamental level to encourage reusing and replacingcomponents. i have an example here thatshows how that works. on the left, there are fourapplications that might want to take a photo forsome reason. so the home application mightwant to pick it from
wallpaper, contacts might wantto pick a person's face to associate with a contact card. gmail or mns, you might want tohave a photo that you send to someone in an outgoingmessage. now, on android, for theseapplications to make use of the service of taking a photo,they first need to make a request. so the client componentmakes a request for specific action. in this case, i'm illustratingthat with a talk balloon.
and the gmail applicationis requesting that it picks a photo. so the talk balloon is actuallya representation of a formal class in our systemcalled an intent. what the system does when arequest is made is it looks at all of the installed componentsand it finds the best available componentthat knows how to do whatever was asked for. in this case, let's say that thesystem finds the built in
photo gallery. now, what happens is the gmailapplication is now connected to the photo gallery. when the user in gmail wantedto pick a photo, he will be taken to the photo gallery. the photo gallery willfulfill whatever was asked for in the intent. what makes this interestingis that the picking of the matching component islate-bound/ it's done very
late, and so you canswap software components at any time. so let's say you didn't like thebuilt in photo gallery and you wanted to replace it withone that went online to find a richer or bigger set of photos,you could replace our built in photo gallery withone that, say, goes out to picassa, or whatever yourfavorite online photo site is. once you've done that, then anyof the applications on the left will now use the new andbetter component on the right
to fulfill the task ofpicking a photo. and at any time, a newapplication can come along and make use of existingfunctionality. so if you're writing a bloggerapplication, you don't have to worry about writing a photopicker yourself. you can just rely on whicheverone the user has configured to be their preferred photopicking application. this becomes really importantbecause in android, it's not just about picking photos.
virtually any task has anintent in the middle. if the user is going from pointa to point b, there's an intent in the middle, and eachof those intents is an opportunity to reusea component or to replace a component. so we have intents for goinghome, which means you can replace a home application. or we have an intent for sendingan email, which means you can replace themail application.
all of these are opportunitiesfor replacing and reusing components. if you're interested infinding out more about android, i encourage you tovisit the developer site and download the sdk. in the sdk, you'll find a lotmore documentation and sample code, and you'll also be ableto try building applications of your own. there's also a developer groupthat you can join to find out
more information.
and i also encourage you tocheck back frequently because we'll be posting updatesto the sdk as the platform matures. thank you for watching.