Robert Ly | 35f2fda | 2013-01-29 16:27:05 -0800 | [diff] [blame] | 1 | page.title=Overview |
| 2 | @jd:body |
| 3 | |
| 4 | <!-- |
| 5 | Copyright 2010 The Android Open Source Project |
| 6 | |
| 7 | Licensed under the Apache License, Version 2.0 (the "License"); |
| 8 | you may not use this file except in compliance with the License. |
| 9 | You may obtain a copy of the License at |
| 10 | |
| 11 | http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | |
| 13 | Unless required by applicable law or agreed to in writing, software |
| 14 | distributed under the License is distributed on an "AS IS" BASIS, |
| 15 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 16 | See the License for the specific language governing permissions and |
| 17 | limitations under the License. |
| 18 | --> |
| 19 | <div id="qv-wrapper"> |
| 20 | <div id="qv"> |
| 21 | <h2> |
| 22 | In this document |
| 23 | </h2> |
| 24 | <ol> |
| 25 | </ol> |
| 26 | </div> |
| 27 | </div> |
| 28 | |
| 29 | <p>Welcome to the Android Platform Development Kit (PDK) Guide! The Android PDK allows partners to port |
| 30 | their drivers as well as develop, optimize, and test against an upcoming Android platform release. |
| 31 | The Android PDK includes a set of interfaces for the Android hardware abstraction layer (HAL), |
| 32 | platform sources for integration, a binary system image, and HAL and integration documentation. |
| 33 | In addition, the PDK also ships with the Android Compatibility Test Suite (CTS). |
| 34 | </p> |
| 35 | |
| 36 | <h2 id="arch">Android Low-Level System Architecture</h2> |
| 37 | <p>Before you begin porting Android to your hardware, it is important to have an |
| 38 | understanding of how Android works at a high level. Because your drivers and HAL code interact |
| 39 | with many layers of Android code, this understanding can help you find |
| 40 | your way through the many layers of code that are available to you through the AOSP |
| 41 | (Android Open Source Project) source tree as well as the PDK. |
| 42 | The following diagram shows a system level view of how Android works: |
| 43 | </p> |
| 44 | |
| 45 | <img src="images/system-architecture.png"> |
| 46 | |
| 47 | <p class="img-caption"><strong>Figure 1.</strong> Android System Architecture</p> |
| 48 | |
| 49 | <h4>Application framework</h4> |
| 50 | <p>This is the level that most application developers concern themselves with. You should be |
| 51 | aware of the APIs available to developers as many of them map 1:1 to the underlying HAL |
| 52 | interfaces and can provide information as to how to implement your driver. |
| 53 | </p> |
| 54 | |
| 55 | <h4>Binder IPC</h4> |
| 56 | <p> |
| 57 | The Binder Inter-Process Communication mechanism allows the application framework to |
| 58 | cross process boundaries and call into the Android system services code. This basically allows |
| 59 | high level framework APIs to interact with Android's system services. At the application framework level, all |
| 60 | of this communication is hidden from the developer and things appear to "just work." |
| 61 | </p> |
| 62 | |
| 63 | <h4>System services</h4> |
| 64 | <p>Most of the functionality exposed through the application framework APIs must |
| 65 | communicate with some sort of system service to access the underlying hardware. Services |
| 66 | are divided into modular components with focused functionality |
| 67 | such as the Window Manager, Search Service, or Notification Manager. System services are grouped |
| 68 | into two buckets: system and media. The system services include things such as the Window or |
| 69 | Notification Manager. The media services include all the services involved in playing and |
| 70 | recording media. |
| 71 | </p> |
| 72 | |
| 73 | <h4>Hardware abstraction layer (HAL)</h4> |
| 74 | <p>The HAL serves as a standard interface that allows the Android system to call into the device |
| 75 | driver layer while being agnostic about the lower-level implementations of your drivers and hardware. |
| 76 | You must implement the corresponding HAL (and driver) for the particular piece of hardware that your product |
| 77 | provides. Android does not mandate a standard interaction between your HAL implementation and your device drivers, so |
| 78 | you have free reign to do what is best for your situation. However, you must abide by the contract |
| 79 | defined in each hardware-specific HAL interface for the Android system to be able |
| 80 | to correctly interact with your hardware. HAL implementations are typically built into |
| 81 | shared library modules (<code>.so</code> files). |
| 82 | </p> |
| 83 | <h4>Linux Kernel</h4> |
| 84 | <p>For the most part, developing your device drivers is the same as developing a typical Linux device driver. |
| 85 | Android uses a specialized version of the Linux kernel with a few special additions such as |
| 86 | wakelocks, a memory management system that is more agressive in preserving memory, |
| 87 | the Binder IPC driver, and other features that are important for a mobile embedded platform like Android. |
| 88 | These additions have less to do with driver development than with the system's functionality. The PDK |
| 89 | does not provide kernel sources, so you must provide your own. You can use any version of the kernel that |
| 90 | you want as long as it supports the required features, such as the binder driver. However, we recommend |
| 91 | using the latest version of the Android kernel. For the latest Android kernel, see |
| 92 | <a href="http://source.android.com/source/building-kernels.html" >Building Kernels</a>. |
| 93 | </p> |
| 94 | |
| 95 | |
| 96 | <h2 id="pdk">PDK Components</h2> |
| 97 | <p>Now that you have a high-level overview of the Android system, we'll go over the PDK and what it provides |
| 98 | to port Android to your product. The PDK provides source files needed to implement |
| 99 | your product and a platform binary that lets you build a runnable system image. You can then install |
| 100 | this barebones image to test your product with the latest builds of Android. The most important source files |
| 101 | included in the PDK are located in the:</p> |
| 102 | |
| 103 | <ul> |
| 104 | <li><code>frameworks/native</code> directory</li> |
| 105 | <li><code>frameworks/av</code> directory for media, camera, DRM, and the audio framework stack</code></li> |
| 106 | <li><code>hardware/libhardware/include/hardware</code> directory for the HAL interfaces </li> |
| 107 | <li><code>vendor/pdk/data/cts</code> directory for the CTS binaries</li> |
| 108 | </ul> |
| 109 | </p> |
| 110 | <p>In addition, the Android PDK includes the following source directories:</p> |
| 111 | <ul> |
| 112 | <li>abi</li> |
| 113 | <li>bionic</li> |
| 114 | <li>bootable</li> |
| 115 | <li>build</li> |
| 116 | <li>device</li> |
| 117 | <li>external (Chromium and Webkit are not included)</li> |
| 118 | <li>hardware</li> |
| 119 | <li>libnativehelper</li> |
| 120 | <li>pdk</li> |
| 121 | <li>prebuilt</li> |
| 122 | <li>prebuilts</li> |
| 123 | <li>system</li> |
| 124 | </ul> |
| 125 | |
| 126 | <p>The PDK also contains documentation that is split into three different sections:</p> |
| 127 | <ul> |
| 128 | <li><a href="{@docRoot}guide/getting_started.html">Getting Started</a> - Explains how to download the PDK source, how the Android build system works, and how to configure a build for your specific product.</li> |
| 129 | <li><a href="{@docRoot}guide/hal.html">The Hardware Abstraction Layer</a> - Explains the various HALs provided by Android and the interfaces (C header files) that define them. </li> |
| 130 | <li><a href="{@docRoot}guide/reference/files.html">HAL reference</a> - A quick reference for the various HAL interfaces.</li> |
| 131 | </ul> |
| 132 | |
| 133 | <h3 id="cts">Compatibility Test Suite</h3> |
| 134 | <p>CTS binaries for ARM, MIPS, and x86 are provided in the corresponding directories in <code>vendor/pdk/data/cts</code>. Only the ARM |
| 135 | variant is Google-verified as there is no Nexus device running on any other architecture. Not all of the CTS tests since the |
| 136 | complete Android platform is not present. The following CTS tests should work:</p> |
| 137 | |
| 138 | <ul> |
| 139 | <li>android.bluetooth</li> |
| 140 | <li>android.graphics</li> |
| 141 | <li>android.graphics2</li> |
| 142 | <li>android.hardware</li> |
| 143 | <li>android.location</li> |
| 144 | <li>android.opengl</li> |
| 145 | <li>android.openglperf</li> |
| 146 | <li>android.media</li> |
| 147 | <li>android.mediastress</li> |
| 148 | <li>android.nativemedia.sl</li> |
| 149 | <li>android.nativemedia.xa</li> |
| 150 | <li>android.net</li> |
| 151 | <li>android.renderscript</li> |
| 152 | </ul> |
| 153 | <p>You can run individual packages such as <code>android.media</code> with:</p> |
| 154 | <pre>cts-tradefed run singleCommand cts --skip-device-info --package android.media</pre> |
| 155 | </ul> |
| 156 | |
| 157 | <p>Because the PDK is missing many components compared to a full Android source tree, |
| 158 | there is a PDK test plan that is provided with CTS that limits the tests that are ran when using the PDK. You can run |
| 159 | this special test plan with the following command:</p> |
| 160 | |
| 161 | <pre>run cts --plan PDK</pre> |
| 162 | |
| 163 | <p>CTS is always actively under development, so we expect some tests to fail. CTS results |
| 164 | for the Galaxy Nexus are provided for you in the |
| 165 | the <code>vendor/pdk/data/cts/</code> directory and will show which tests fail on that |
| 166 | device. You can safely ignore the failed tests for your devices as well.</p> |
| 167 | |
| 168 | <p>See the <a href="http://source.android.com/compatibility/cts-intro.html">CTS manual</a> for more information on CTS.</p> |
| 169 | |
| 170 | <h2 id="inc-ex">PDK Inclusions and Exclusions</h2> |
| 171 | <p>The PDK is a subset of the complete Android source tree and might be missing things that you might need. Here is a list of what the PDK supports |
| 172 | and does not support:</p> |
| 173 | <ul> |
| 174 | <li>Supports building Android apps using the publicly available, standard SDK. Builds with non-public platform APIs are not supported. The JNI build is supported.</li> |
| 175 | <li>Supports only <code>en_US</code> locale.</li> |
| 176 | <li>Supports only phone layouts. Tablet layouts are not included.</li> |
| 177 | <li>Enables support for software navigation buttons by default, which you can disable by setting <code>qemu.jw.mainkeys=1</code>.</li> |
| 178 | <li>Builds all binaries with SMP (symmetric multiprocessing) features enabled. This might have a small performance impact on non-SMP CPUs.</li> |
| 179 | <li>Includes a minimal amount of Java libraries. Obtain any additional Java libraries from the publicly released Android source tree.</li> |
| 180 | <li>Contains a minimum number of applications. Build and install necessary applications as needed.</li> |
| 181 | <li>Does not support media streaming.</li> |
| 182 | <li>Does not include non-Latin fonts. (set by <code>MINIMAL_FONT_FOOTPRINT</code> variable in <code>BoardConfig.mk</code>). |
| 183 | An app might crash if it requires such fonts. </li> |
| 184 | <li>Does not support replacing framework resources by using the overlay mechanism. |
| 185 | This means all configurations controlled by framework resources are fixed.</li> |
| 186 | <li>Does not support NFC</li> |
| 187 | <li>Does not support DRM</li> |
| 188 | </ul> |
| 189 | |
| 190 | <h2 id="knownissues">Support and Known Issues</h2> |
| 191 | <p> |
| 192 | For questions or to report issues related with the PDK, send a message to the <a href="https://groups.google.com/a/google.com/forum/?fromgroups#!forum/android-pdk-feedback">android-pdk@google.com</a> mailing list.</p> |
| 193 | |
| 194 | <p>The following list describes the known issues with the PDK:</p> |
| 195 | <ul> |
| 196 | <li>After running the CTS (Compatibility Test Suite), <code>android.process.acore</code> crashes. This is caused by |
| 197 | some missing components in PDK and does not affect the operation of CTS tests.</li> |
| 198 | </p> |