打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
What Android Is

What Android Is

Search

Being an il-lus-trated run through the ba-sics.

What hap-pened was, for our re-cent South Amer-i-can tour I wanted an An-droidar-chi-tec-ture overview graphic. I ran across, among the An-droid SDK doc-u-men-ta-tion,a page en-ti-tled Whatis An-droid?, and it’s per-fectly OK. Ex-cept for, I re-allydis-liked the pic-ture — on purely aes-thetic grounds, just not my kind of let-ter-ing andgra-di-ents and lay-outs — so I de-cided to make an-other one.

I thought I’d run it here and, since I’ve been spend-ing a lot of timere-cently ex-plain-ing What An-droid Is to peo-ple, I thought I’d pro-vide myver-sion of that as well, in nar-ra-tive rather than point form.


First of all, as Dan Mor-rill mem-o-rably ex-plained in On An-droid Com-pat-i-bil-ity,“An-droid is not a spec-i-fi-ca-tion, or a dis-tri-b-u-tion in the tra-di-tional Linuxsense. It’s not a col-lec-tion of re-place-able com-po-nents. An-droid is a chunk ofsoft-ware that you port to a de-vice.”

Linux · Un-der-neath every-thing is a rea-son-ably up-to-dateLinux ker-nel (2.6.32 in mycur-rent Nexus One run-ning Froyo), with some power-sav-ing ex-ten-sions wecooked up; the process of try-ing to merge this stuff into up-streamLinux has beenex-tended and pub-lic and is by no means over. ?

An-droid runs on Linux, but I’d be ner-vous about call-ing it adis-trobe-cause it leaves out so much that peo-ple ex-pect in one of those: li-brariesand shells and ed-i-tors and GUIs and pro-gram-ming frame-works.It’s a pretty naked ker-nel, which be-comes ob-vi-ous the first time you findyour-self using a shell on an An-droid de-vice.

If it were a dis-tro it’d be one of the higher-vol-ume ones, ship-ping at 200Kunits a day in late 2010. But no-body counts these things, and then there are a ton ofem-bed-ded fla-vors of Linux ship-ping in un-re-mark-able pieces of con-sumerelec-tron-ics, so there’s a re-fresh-ing ab-sence of any-one claim-ing to be “themost pop-u-lar Linux”. I like that.

Dalvik · The next big piece isDalvik,com-pris-ing the VM and a wholebunch of basic run-time es-sen-tials. Its de-sign is fairly unique, and judg-ing byre-cent his-tory, seems to be work-ing out pretty well as a mo-bile-de-vice app sub-strate. ?

All the stan-dard APIs that you use to cre-ate An-droid apps are de-finedin terms of Dalvik classes and in-ter-faces and ob-jects and meth-ods.In fact, some of them are thin lay-ers of Dalvik code over na-tive im-ple-men-ta-tions.

It’s pos-si-ble, and com-mon prac-tice, to call back and forth be-tween Dalvikand na-tive code using theJNI pro-to-col, which is a neat trick since what’srun-ning on Dalvik isn’t any-thing like Java byte-codes on a Java VM.

How It’s Gen-er-ated · Na-tive code is cur-rently pro-duced more or less ex-clu-sively by com-pil-ing Cor C++ code; but there’s no rea-son it has to be that way. Dalvik codeis cur-rently pro-duced by gen-er-at-ing Java byte-codes and trans-lat-ing them; butthere’s no rea-son it has to be that way. ?

I want to em-pha-size this point a lit-tle. An-droid apps are de-fined as codethat runs on the plat-form and uses the APIs. As long as an app does these thingsprop-erly, it’s re-ally no-body’s con-cern how it got gen-er-ated.

Spe-cial Apps · The pic-ture is a lit-tle mis-lead-ing, be-cause some of those Dalvik-based appsare pro-vided by Google and some-times are seen as “part ofAn-droid”. I’m talk-ing about the Di-aler and Con-tacts and Cal-en-dar and Gmailand Chat and so on. Most of them are open-source and re-place-able (and havebeen re-placed by hand-set mak-ers); a few are closed-source and pro-pri-etary,like Google Maps and An-droid Mar-ket. ?

That Open-Source Thing · In the big pic-ture above, most of the stuff in green is Apache-li-censed.The rest is a mix-ture of GPL and LGPL and BSD, with some Apache in there too.This ex-cludes some low-level de-vice dri-vers and ofcourse the ma-jor-ity of non-Google apps, which are closed-source. ?

The Frame-work · This is the stuff that uniquely de-fines An-droid; more or less every-thingthat Google wrote and you wouldn’t ex-pect to find on area-son-ably-con-fig-ured GNU/Linux box. Its proper use is the sub-ject of all themany pages on dis-play at developer.?android.?com and ofend-less mail-ing lists, sam-ple sites, and a grow-ing num-ber of books. ?

I like it; but you al-ready knew that.

Li-braries · The word “stan-dard” here means “gen-er-ally avail-able to pro-gram-merswork-ing in an open-source en-vi-ron-ment”. The pic-ture isn’t com-pre-hen-sive. ?

Quite a few peo-ple, in-clud-ing me, have over-em-pha-sized the role of theHar-mony li-braries. To start with,the An-droid se-lec-tion ex-cludes lots of stuff, for ex-am-pleAWT andSwing andOMGCORBA; all su-per-flu-ous for apps using theAn-droid frame-work.

Also, just count-ing roughly by code bulk of all the sort of stuff in thispic-ture, the Har-mony code com-prises less than half the total. I don’t want todiss Har-mony, they’re a won-der-ful pro-ject and I’m a huge fan; but it’sin-ac-cu-rate to give the im-pres-sion thatAn-droid is just Dalvik plus Har-mony.

· · ·

What’s In an App? · An An-droid app lives in what’s called anAPK, which is sim-ply a ZIP file, with a par-tic-u-larin-ter-nal file lay-out that al-lows it to be run in place, with-out un-pack-ing.There’s noth-ing magic about them, you can email them around anddrop them on USB keys and ex-tract pieces with unzip. ?

TheAn-droidMan-i-fest is the in-ter-face be-tween an app and the An-droid sys-tem, andthat’s all I’m going to say here be-cause it’s a key piece of the puz-zle andde-serves lengthy dis-cus-sion if any at all.

The re-source bun-dle con-tains your audio and video and graph-icsand so on, the pieces that come with the app as op-posed to being fetched overthe net-work.

Na-tive or Not · Most apps these days are writ-ten for Dalvik.When I say “most apps” I mean “every-thing that isn’t agame”; game de-vel-op-ers typ-i-cally want to code in C/C++ and that’s it. Dalvikof-fers a nice fast gate-way to OpenGL and all the phone’s hard-ware, but gamedevs just don’t want to hear about vir-tual ma-chines, so they use theAn-droid NDK. ?

If you’re writ-ing code in the Java pro-gram-ming lan-guage you can use Eclipse and apretty nice tool-chain that makes the bar-rier to entry re-mark-ably low. Ifyou’re cod-ing to the NDK, you’re going to be doing a lot of thebuild-time ma-chin-ery your-self and liv-ing with-out some of the nice de-bug-gingand pro-fil-ing candy, not to men-tion sign-ing up to port your code to other CPUar-chi-tec-tures if they run An-droid and have lots of users. But game de-vel-op-ers revel in pain.

And that’s what An-droid is · Hope you liked the pic-tures. ?


My thanks toDan Born-stein andDan Mor-rill forsan-ity-check-ing this and of-fer-ing sev-eral sig-nif-i-cant im-prove-ments.
[Up-dated:] A cou-ple of fact-checks con-tributed by Brian Swet-land.


Comments on this fragment are closed.

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
New: 10 of the best Droid apps for education in 2012
推荐5个Android上值得下载的软件
Inside Andy Rubin's Quest to Create an OS for Ever...
how to build android cts
下接 android linux 基础知识总结[下]7
Darktremor 2.7.5.3 Beta 04 [HeroCDMA] (01/29/2011)
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服