blob: f86b56805a356e9286c857f7574953617285a567 [file] [log] [blame]
The Android Open Source Project5c118522008-10-21 07:00:00 -07001
2<html>
3<head>
4<meta http-equiv="content-type" content="text/html; charset=utf-8"/>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -08005<title>Android - Porting Guide</title>
The Android Open Source Project5c118522008-10-21 07:00:00 -07006<script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=internal-codesite" type="text/javascript"></script>
7<script src="http://code.google.com/js/jquery.js" type="text/javascript"></script>
8<script type="text/javascript">var _tocPath_ = 'http://code.google.com/android/_toc.ezt';</script>
9<script src="http://code.google.com/js/codesite.pack.01312008.js" type="text/javascript"></script>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -080010<script language="JavaScript">
11function resizeHeight() {
12 if(document.getElementById && !(document.all)) {
13 height= document.getElementById('doxygen').contentDocument.body.scrollHeight + 20;
14 document.getElementById('doxygen').style.height = height;
15 }
16 else if(document.all) {
17 height= document.frames('doxygen').document.body.scrollHeight + 20;
18 document.all.doxygen.style.height = height;
19 }
20}
21</script>
The Android Open Source Project5c118522008-10-21 07:00:00 -070022<link href="http://code.google.com/css/codesite.pack.01312008.css" type="text/css" rel="stylesheet">
23</link>
24
25<!--[if IE]><link rel="stylesheet" type="text/css" href="/css/iehacks.css" /><![endif]-->
26<script src="http://code.google.com/android/assets/search_autocomplete.js"></script>
27<link rel="stylesheet" type="text/css" href="http://code.google.com/css/semantic_headers.css" />
28<link rel="stylesheet" type="text/css" href="http://code.google.com/android/assets/style.css" />
29<script>
30 jQuery(document).ready(function() {
31 jQuery("pre").addClass("prettyprint");
32 });
33 </script>
34<style type="text/css">
35<!--
36h1,h2,h3 {
37 color: #000000;
38}
39-->
40</style>
41</head>
42<body class="gc-documentation">
43<div id="gc-container">
44<a name="top"></a>
45<div id="skipto"> </div>
46<div id="langpref">
47 <!--<a class="dropdown" href="/">English</a> <span>|</span> <a href="/more/">Site Directory</a> -->
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -080048
The Android Open Source Project5c118522008-10-21 07:00:00 -070049</div>
50<div id="gc-header">
51 <div id="logo"><a href="http://code.google.com/android/index.html"><img src="http://code.google.com/android/images/logo_android.gif" alt="Android"/></a></div>
52 <div id="search" style="inline">
53 <div id="searchForm" class="searchForm" style="height: 44px;">
54 <!--previously form was here-->
55 </div>
56 <!-- end searchForm -->
57 <noscript>
58 <style type="text/css">
59 .searchForm {
60 display : none !important;
61 }
62 .searchForm2 {
63 display : inline !important;
64 }
65 </style>
66 </noscript>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -080067
The Android Open Source Project5c118522008-10-21 07:00:00 -070068 <div id="searchForm2" class="searchForm2" style="display:none">
69 <form id="searchbox_001456098540849067467:6whlsytkdqg" action="http://www.google.com/cse">
70 <input type="hidden" name="cx" value="001456098540849067467:6whlsytkdqg" />
71 <input type="hidden" name="cof" value="FORID:0" />
72 <input type="text" name="q" maxlength="2048" size="41" autocomplete="off" title="Google Code Search"/>
73 <input type="submit" name="sa" value="Search" title="Search"/>
74 <br/>
75 <div class="greytext">e.g. "ajax apis" or "open source"</div>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -080076
The Android Open Source Project5c118522008-10-21 07:00:00 -070077 </form>
78 </div>
79 <!-- end searchForm2 -->
80 </div>
81 <!-- end search -->
82</div>
83<!-- end gc-header -->
84<div id="searchControl" class="search-control"></div>
85<!--[if IE]><iframe id="backiFrame" name="backiFrame" src='/dummy.html' style="display:none"></iframe><![endif]-->
86<div id="codesiteContent">
87<a name="gc-topnav-anchor"></a>
88<div id="gc-topnav">
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -080089
The Android Open Source Project5c118522008-10-21 07:00:00 -070090 <h1>Android Platform Development Kit</h1>
91 <ul class="gc-topnav-tabs">
92 <li id="sdk_link"> <a href="http://code.google.com/android/index.html" title="Android Software Development Kit">SDK</a> </li>
93 <li id="docs_link"> <a href="index.html" title="Official Android documentation">Docs</a> </li>
94 <li id="faq_link"> <a href="http://code.google.com/android/kb/index.html" title="Answers to frequently asked questions about Android">FAQ</a> </li>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -080095
The Android Open Source Project5c118522008-10-21 07:00:00 -070096 <li> <a href="http://android-developers.blogspot.com/" title="Official Android blog">Blog</a> </li>
97 <li> <a href="http://code.google.com/android/groups.html" title="Android developer forum">Group</a> </li>
98 <li> <a href="http://code.google.com/android/terms.html" title="Android terms of service">Terms</a> </li>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -080099 <li> <a href="mailto:android-pdk-feedback@google.com?subject=PDK%20Feedback&body=(filed%20from:%20index.html%20v0.5%20-%2025%20September%202008)%0D%0A%0D%0ASUMMARY:%0D%0A%0D%0A%0D%0A%0D%0ASTEPS%20TO%20REPRODUCE:%0D%0A%0D%0A%0D%0A%0D%0AADDITIONAL%20NOTES:">Report a Problem</a> </li>
100
The Android Open Source Project5c118522008-10-21 07:00:00 -0700101 </ul>
102</div>
103<!-- end gc-topnav -->
104<div class="g-section g-tpl-180">
105<a name="gc-toc"></a>
106<div class="g-unit g-first" id="gc-toc">
107 <ul>
108 <li>
109 <h1><a href="index.html">Documentation</a></h1>
110 <ul>
111 <li> <strong>Introduction</strong>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800112
The Android Open Source Project5c118522008-10-21 07:00:00 -0700113 <ul>
114 <li><a href="system_requirements.html">Device Requirements</a></li>
115 </ul>
116 </li>
117 <li> <strong>Dev Environment Setup</strong>
118 <ul>
119 <li><a href="source_setup_guide.html">Host System Setup</a></li>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800120
The Android Open Source Project5c118522008-10-21 07:00:00 -0700121 <li><a href="getting_source_code.html">Getting Source Code</a></li>
122 <li> <a href="intro_source_code.html">Source Code Overview</a></li>
123 <li><a href="build_system.html">Build System</a></li>
124 </ul>
125 </li>
126 <li> <strong>Basic Bring up</strong>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800127
The Android Open Source Project5c118522008-10-21 07:00:00 -0700128 <ul>
129 <li><a href="build_new_device.html">Building New Device</a></li>
130 <li><a href="bring_up.html">Bring up</a></li>
131 <li><a href="keymaps_keyboard_input.html">Keymaps and Keyboard</a></li>
132 <li><a href="display_drivers.html">Display Drivers</a></li>
133 </ul>
134 </li>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800135
The Android Open Source Project5c118522008-10-21 07:00:00 -0700136 <li> <strong>Multimedia</strong>
137 <ul>
138 <li><a href="audio_sub_system.html">Audio Subsystem</a></li>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800139 <li><a href="camera.html">Camera</a></li>
The Android Open Source Project5c118522008-10-21 07:00:00 -0700140 </ul>
141 </li>
142 <li> <strong>Power Management</strong>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800143
The Android Open Source Project5c118522008-10-21 07:00:00 -0700144 <ul>
145 <li><a href="power_management.html">Power Management</a></li>
146 </ul>
147 </li>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800148
149 <li> <strong>Networking</strong>
150 <ul>
151 <li><a href="wifi.html">Wi-Fi</a></li>
152 <li><a href="gps.html">GPS</a></li>
153 <li><a href="bluetooth.html">Bluetooth</a></li>
154 </ul>
155 </li>
156
The Android Open Source Project5c118522008-10-21 07:00:00 -0700157 <li> <strong>Telephony</strong>
158 <ul>
159 <li><a href="telephony.html">Radio Interface Layer</a></li>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800160
The Android Open Source Project5c118522008-10-21 07:00:00 -0700161 </ul>
162 </li>
163 <li> <strong>Testing</strong>
164 <ul>
The Android Open Source Project5c118522008-10-21 07:00:00 -0700165 <li><a href="instrumentation_testing.html">Instrumentation Testing</a></li>
166 </ul>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800167
The Android Open Source Project5c118522008-10-21 07:00:00 -0700168 </li>
169 </ul>
170 </li>
171 </ul>
172</div>
173<a name="gc-pagecontent"></a>
174<div class="g-unit" id="gc-pagecontent">
175<div id="jd-content">
176<div class="jd-descr">
177
178
179<a name="androidIntroSourceCodeTitle"></a><h1>Source Code Overview</h1>
180
181
182
183<a name="toc"/>
184<div style="padding:10px">
185<a href="#androidSourceCodeDirectories">Introduction</a><br/>
186<a href="#Android_Source">Android Source</a><br/><div style="padding-left:40px">
187
188<a href="#androidSourceCodeDirectoriesKernel">Linux Kernel</a><br/>
189<a href="#androidSourceCodeDirectoriesDevice">Android Platform and Applications</a><br/></div>
190<a href="#androidSourceGuidelines">Adding Source Code</a><br/></div></font></div>
191
192<a name="androidSourceCodeDirectories"></a><h2>Introduction</h2>
193
194<p>Android source code is maintained in two code bases: the Android Linux kernel (<code>kernel</code> directory) and Android platform and applications (<code>device</code> directory). This document provides a high-level introduction to the source code organization and an overview of the major components of each primary directory.</p>
195
196<a name="Android_Source"></a><h2>Android Source</h2>
197
198
199<a name="androidSourceCodeDirectoriesKernel"></a><h3>Linux Kernel</h3>
200
201<p>The Android Linux kernel includes enhancements to the Linux 2.6 kernel that provide additional drivers to support the Android platform, including:</p>
202<ul>
203 <li>Binder: an OpenBinder-based driver to facilitate inter-process communication (IPC) in the Android platform.</li>
204 <li>Android Power Management: a light weight power management driver built on top of standard Linux power management but optimized for embedded systems.</li>
205 <li>Low Memory Killer: Based on hints from the userspace, the low memory killer can kill off processes to free up memory as necessary. It is designed to provide more flexibility than the Out Of Memory (OOM) killer in the standard kernel.</li>
206 <li>Logger: A light weight logging device used to capture system, radio, logdata, etc.</li>
207 <li>USB Gadget: Uses the USB function framework.</li>
208 <li>Android/PMEM: The PMEM (physical memory) driver is used to provide contiguous physical memory regions to userspace libraries that interact with the digital signal processor (DSP) and other hardware that cannot cope with scatter-gather.</li>
209 <li>Android Alarm: A driver which provides timers that can wake the device up from sleep and a monotonic timebase that runs while the device is asleep.</li>
210</ul>
211<p>Look for Android-specific enhancements in the following directories:</p>
212<p><ul>
213<li><code>/drivers/android</code></li>
214<li><code>/drivers/misc</code></li>
215<li><code>/include/linux</code></li>
216</ul>
217</p>
218
219
220<a name="androidSourceCodeDirectoriesDevice"></a><h3>Android Platform and Applications</h3>
221
222<p>The following list outlines the directory structure found within the <code>device</code> branch of Android source code:</p>
223
224
225<p><span class="lh2"><a name="gmapiMobileTagsListStart"></a></span>
226
227<ul>
228
229
230<li>apps
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800231Core Android applications such as Phone, Camera, and Calendar.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700232</li>
233
234
235<li>boot
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800236Reference Android bootloader and other boot-related source code.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700237</li>
238
239
240<li>commands
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800241Common Android commands, the most important of which is the runtime command, which does much of the initialization of the system.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700242</li>
243
244
245<li>config
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800246System-wide makefiles and linker scripts.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700247</li>
248
249
250<li>content
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800251Standard Android ContentProvider modules.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700252</li>
253
254
255<li>dalvik
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800256Android runtime Virtual Machine (VM).
The Android Open Source Project5c118522008-10-21 07:00:00 -0700257</li>
258
259
260<li>data
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800261Fonts, keymaps, sounds, timezone information, etc.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700262</li>
263
264
265<li>docs
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800266Full set of Android documentation.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700267</li>
268
269
270<li>extlibs
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800271Non-Android libraries. This directory is intended to host unmodified external code. None of the libraries included within this directory rely on Android headers or libraries.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700272</li>
273
274
275<li>ide
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800276Tools for support of the IDE's used to write Android applications.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700277</li>
278
279
280<li>include
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800281Android system headers for inclusion.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700282</li>
283
284
285<li>java
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800286Android core APIs, as well as some external libraries.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700287</li>
288
289
290<li>libs
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800291Android-specific C++ based libraries.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700292</li>
293
294
295<li>partner
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800296Project-specific source code for various proprietary components.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700297</li>
298
299
300<li>prebuilt
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800301Prebuilt tools, like the toolchains and emulator binary.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700302</li>
303
304
305<li>product
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800306Device-specific configuration files. This directory will include a subdirectory for each new device.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700307</li>
308
309
310<li>samples
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800311Sample applications.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700312</li>
313
314
315<li>servers
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800316C++ based system servers.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700317</li>
318
319
320<li>system
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800321Core of the embedded Linux platform at the heart of Android. These essential bits are required for basic booting, operation, and debugging.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700322</li>
323
324
325<li>tests
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800326Platform and application test cases.
The Android Open Source Project5c118522008-10-21 07:00:00 -0700327</li>
328
329
330<li>tools
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800331Tools for building and debugging Android (of particular interest for porting are "adb" and "emulator").
The Android Open Source Project5c118522008-10-21 07:00:00 -0700332</li>
333
334
335
336<p><span class="lh2"><a name="gmapiMobileTagsListEnd"></a></span>
337
338</ul>
339
340
341<a name="androidSourceGuidelines"></a><h2>Adding Source Code</h2>
342
343<p>You can develop Android applications with the same standard tools you use to develop any Java application. The Android core libraries provide the functionality needed to build rich mobile applications and the Android development tools are designed to simplify running, debugging, and testing your applications.</p>
344
345<p>Add project-specific source code to the Android source tree under the <code>partner</code> directory in a directory specific to the application or service you are building. For example, all Google-specific applications would be placed under <code>device/partner/google/</code>. A Google search application would be placed under <code>device/partner/google/apps/Search</code>.
346<p>See <a href="build_new_device.html">Building Android for a new Mobile Device</a> for detailed instructions.</p>
347
348
349
350<p><span class="lh2"><a name="androidFooter"></a></span>
351
352 </div>
353 </div>
354 <!-- end gc-pagecontent -->
355 </div>
356 <!-- end gooey wrapper -->
357 </div>
358 <!-- end codesearchresults -->
359 <div id="gc-footer" dir="ltr">
360 <div class="text"> &copy;2008 Google<!-- - <a href="/">Code Home</a> - <a href="http://www.google.com/accounts/TOS">Site Terms of Service</a> - <a href="http://www.google.com/privacy.html">Privacy Policy</a> - <a href="/more">Site Directory</a> --></div>
361 </div>
362 <!-- end gc-footer -->
363</div>
364<!-- end gc-containter -->
365<script src="http://www.google-analytics.com/ga.js" type="text/javascript">
366</script>
367<script type="text/javascript">
368 try {
369 var pageTracker = _gat._getTracker("UA-18071-1");
370 pageTracker._setAllowAnchor(true);
371 pageTracker._initData();
372 pageTracker._trackPageview();
373 } catch(e) {}
374</script>
The Android Open Source Projecte943f2f2008-12-17 18:04:04 -0800375<div id="jd-build-id"> v0.5 - 25 September 2008</div>
The Android Open Source Project5c118522008-10-21 07:00:00 -0700376</div></div></div></body>
377</html>
378