Code drop from //branches/cupcake/...@124589
diff --git a/pdk/docs/audio_sub_system.html b/pdk/docs/audio_sub_system.html
index 8f72e38..e0cf217 100755
--- a/pdk/docs/audio_sub_system.html
+++ b/pdk/docs/audio_sub_system.html
@@ -2,11 +2,23 @@
 <html>
 <head>
 <meta http-equiv="content-type" content="text/html; charset=utf-8"/>
-<title>Android - Audio Subsystem</title>
+<title>Android - Porting Guide</title>
 <script src="http://www.google.com/uds/api?file=uds.js&amp;v=1.0&amp;key=internal-codesite" type="text/javascript"></script>
 <script src="http://code.google.com/js/jquery.js" type="text/javascript"></script>
 <script type="text/javascript">var _tocPath_ = 'http://code.google.com/android/_toc.ezt';</script>
 <script src="http://code.google.com/js/codesite.pack.01312008.js" type="text/javascript"></script>
+<script language="JavaScript">
+function resizeHeight() {
+	if(document.getElementById && !(document.all)) {
+		height= document.getElementById('doxygen').contentDocument.body.scrollHeight + 20;
+		document.getElementById('doxygen').style.height = height;
+	}
+	else if(document.all) {
+		height= document.frames('doxygen').document.body.scrollHeight + 20;
+		document.all.doxygen.style.height = height;
+	}
+}
+</script>
 <link href="http://code.google.com/css/codesite.pack.01312008.css" type="text/css" rel="stylesheet">
 </link>
 
@@ -33,6 +45,7 @@
 <div id="skipto"> </div>
 <div id="langpref">
   <!--<a class="dropdown" href="/">English</a> <span>|</span> <a href="/more/">Site Directory</a> -->
+
 </div>
 <div id="gc-header">
   <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>
@@ -51,6 +64,7 @@
       }
       </style>
     </noscript>
+
     <div id="searchForm2" class="searchForm2" style="display:none">
       <form id="searchbox_001456098540849067467:6whlsytkdqg" action="http://www.google.com/cse">
         <input type="hidden" name="cx" value="001456098540849067467:6whlsytkdqg" />
@@ -59,6 +73,7 @@
         <input type="submit" name="sa" value="Search" title="Search"/>
         <br/>
         <div class="greytext">e.g. "ajax apis" or "open source"</div>
+
       </form>
     </div>
     <!-- end searchForm2 -->
@@ -71,15 +86,18 @@
 <div id="codesiteContent">
 <a name="gc-topnav-anchor"></a>
 <div id="gc-topnav">
+
   <h1>Android Platform Development Kit</h1>
   <ul class="gc-topnav-tabs">
     <li id="sdk_link"> <a href="http://code.google.com/android/index.html" title="Android Software Development Kit">SDK</a> </li>
     <li id="docs_link"> <a href="index.html" title="Official Android documentation">Docs</a> </li>
     <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>
+
     <li> <a href="http://android-developers.blogspot.com/" title="Official Android blog">Blog</a> </li>
     <li> <a href="http://code.google.com/android/groups.html" title="Android developer forum">Group</a> </li>
     <li> <a href="http://code.google.com/android/terms.html" title="Android terms of service">Terms</a> </li>
-    <li> <a href="mailto:android-pdk-feedback@google.com?subject=PDK%20Feedback&body=(filed%20from:%20audio_sub_system.html%20v0.3%20-%209%20June%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>
+    <li> <a href="mailto:android-pdk-feedback@google.com?subject=PDK%20Feedback&body=(filed%20from:%20audio_sub_system.html%20v0.6%20-%2025%20November%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>
+
   </ul>
 </div>
 <!-- end gc-topnav -->
@@ -91,19 +109,18 @@
       <h1><a href="index.html">Documentation</a></h1>
       <ul>
         <li> <strong>Introduction</strong>
+
           <ul>
             <li><a href="system_requirements.html">Device Requirements</a></li>            
           </ul>
         </li>
         <li> <strong>Dev Environment Setup</strong>
           <ul>
-            <li><a href="source_setup_guide.html">Host System Setup</a></li>
-            <li><a href="getting_source_code.html">Getting Source Code</a></li>
-            <li> <a href="intro_source_code.html">Source Code Overview</a></li>			
             <li><a href="build_system.html">Build System</a></li>
           </ul>
         </li>
         <li> <strong>Basic Bring up</strong>
+
           <ul>
             <li><a href="build_new_device.html">Building New Device</a></li>
             <li><a href="bring_up.html">Bring up</a></li>
@@ -111,26 +128,39 @@
             <li><a href="display_drivers.html">Display Drivers</a></li>
           </ul>
         </li>
+
         <li> <strong>Multimedia</strong>
           <ul>
-            <li><a href="audio_sub_system.html">Audio Subsystem</a></li>
+            <li><a href="audio_sub_system.html">Audio</a></li>
+            <li><a href="camera.html">Camera</a></li>			
           </ul>
         </li>
         <li> <strong>Power Management</strong>
+
           <ul>
             <li><a href="power_management.html">Power Management</a></li>
           </ul>
         </li>
+
+        <li> <strong>Networking</strong>
+          <ul>
+            <li><a href="wifi.html">Wi-Fi</a></li>
+            <li><a href="gps.html">GPS</a></li>
+            <li><a href="bluetooth.html">Bluetooth</a></li>
+          </ul>
+        </li>
+
         <li> <strong>Telephony</strong>
           <ul>
             <li><a href="telephony.html">Radio Interface Layer</a></li>
+
           </ul>
         </li>
         <li> <strong>Testing</strong>
           <ul>
-            <li><a href="instrumentation_framework.html">Instrumentation Framework</a></li>
             <li><a href="instrumentation_testing.html">Instrumentation Testing</a></li>
           </ul>
+
         </li>
       </ul>
     </li>
@@ -142,78 +172,64 @@
 <div class="jd-descr">
 
 
-<a name="androidAudioSubSystemTitle"></a><h1>Audio Subsystem</h1>
+<a name="androidAudioSubSystemTitle"></a><h1>Audio</h1>
 
 
 
 <a name="toc"/>
 <div style="padding:10px">
 <a href="#androidAudioSubSystemIntroduction">Introduction</a><br/>
-<a href="#androidAudioSubSystemPorting">Porting Android to other Audio Stacks</a><br/><div style="padding-left:40px">
-
-<a href="#androidAudioSubSystemAbstract">AudioHardwareInterface Abstract Class</a><br/>
-<a href="#androidAudioSubSystemAudioHardwareInterfaceModification">Modifying AudioHardwareInterface</a><br/></div></div></font></div>
+<a href="#androidAudioBuildingDriver">Building an Audio Library</a><br/>
+<a href="#androidAudioInterface">Interface</a><br/></div></font></div>
 
 <a name="androidAudioSubSystemIntroduction"></a><h2>Introduction</h2>
 
-<p>Android provides two native layers that handle audio software:</p>
-<p><ul><li><b>Audio Flinger</b>: the audio software implementation that provides the minimum required audio functions (as illustrated in the diagram below).</li>
-<li><b>AudioHardwareInterface</b>: the hardware abstraction layer that hides driver-specific audio implementations from the Android platform.</li>
-</ul>
-</p>
+<p>AudioHardwareInterface serves as the glue between proprietary audio drivers and the Android AudioFlinger service, the core audio service that handles all audio-related requests from applications.</p>
 <p><img src="android_audio_architecture.gif"></p>
 
-Solid elements represent Android blocks and dashed elements represent partner-specific proprietary blocks.
+Solid elements represent Android blocks and dashed elements represent partner-specific blocks.
 
 
 
-<a name="androidAudioSubSystemPorting"></a><h2>Porting Android to other Audio Stacks</h2>
+<a name="androidAudioBuildingDriver"></a><h2>Building an Audio Library</h2>
 
-<p>Porting Android to other audio stacks (OSS, ALSA, proprietary user-space audio libraries, etc.) requires inheriting from and modifying <code>AudioHardwareInterface</code> to support the driver-specific implementation.</p>
+<p>To implement an audio driver, create a shared library that implements the interface defined in <code>AudioHardwareInterface.h</code>. You must name your shared library <code>libaudio.so</code> so that it will get loaded from <code>/system/lib</code> at runtime.  Place libaudio sources and <code>Android.mk</code> in <code>partner/acme/chipset_or_board/libaudio/</code>.</p>
+<p>The following stub <code>Android.mk</code> file ensures that <code>libaudio</code> compiles and links to the appropriate libraries:</p>
 
-
-<a name="androidAudioSubSystemAbstract"></a><h3>AudioHardwareInterface Abstract Class</h3>
-
-<p><code>AudioHardwareInterface</code> (<code>//device/servers/audio/flinger</code>) contains several pure virtual functions that the audio driver class being ported needs to implement.</p>
-
-
-<a name="androidAudioSubSystemAudioHardwareInterfaceModification"></a><h3>Modifying AudioHardwareInterface</h3>
-
-<p>Once the audio driver that inherits <code>AudioHardwareInterface</code> is ready, modify the static function <code>AudioHardwareInterface::create()</code> in order to link/load the driver in Android.</p>
-
-
-<p>Assume the manufacturer audio driver inherits from <code>AudioHarddwareInterface</code> and that it is compiled into a native shared library (<code>libaudio.so</code>). In this case, use <code>dlopen</code> to load the library.</p>
-<p>You can find an example of a similar implementation in <code>//device/libs/media/mediaplayer.cpp</code>. (Note that the example below uses <code>libpv.so</code> because this is a real code snippet from <code>mediaplayer.cpp</code>. If your native shared library is called <code>libaudio.so</code>, replace <code>libpv.so</code> with your <code>libaudio.so</code>.)
-<pre box="prettify">
-// load PV library and create PV player
-mLibHandle = dlopen("libpv.so", RTLD_NOW);
-if (!mLibHandle) {
-   LOGE("dlopen failed on libpv.so\n");
-   return UNKNOWN_ERROR;
-}
-createPlayer_f createPlayer = reinterpret_cast<createPlayer_f>(dlsym(mLibHandle, "createPlayer"));
-if (!createPlayer) {
-   LOGE("dlsym failed on createPlayer in libpv.so\n");
-   return UNKNOWN_ERROR;
-}
-</pre>
-<p>Load the libraries with a call from <code>AudioHardwareInterface::create()</code>, as illustrated below (full code found in <code>//device/servers/audioflinger</code>).</p>
 <pre class="prettify">
-if (property_get("ro.kernel.qemu", value, 0)) {
-   LOGD("Running in emulation - using generic audio driver");
-   hw = new AudioHardwareGeneric();
-}
-else {
-   // Insert calling of dynamic loading of driver here...
-}
-if (hw->initCheck() != NO_ERROR) {
-   LOGW("Using stubbed audio hardware. No sound will be produced.");
-   delete hw;
-   hw = new AudioHardwareStub();
-}
+LOCAL_PATH := $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE := libaudio
+
+LOCAL_SHARED_LIBRARIES := \
+    libcutils \
+    libutils \
+    libmedia \
+    libhardware
+
+LOCAL_SRC_FILES += MyAudioHardware.cpp
+
+LOCAL_CFLAGS +=
+
+LOCAL_C_INCLUDES +=
+
+LOCAL_STATIC_LIBRARIES += libaudiointerface
+
+include $(BUILD_SHARED_LIBRARY)
 </pre>
 
 
+<a name="androidAudioInterface"></a><h2>Interface</h2>
+
+
+
+<p class="note"><strong>Note</strong>: This document relies on some Doxygen-generated content that appears in an iFrame below. To return to the Doxygen default content for this page, <a href="audio_sub_system.html">click here</a>.</p>
+
+
+<iframe onLoad="resizeHeight();" src="_audio_hardware_interface_8h.html" scrolling="no" scroll="no" id="doxygen" marginwidth="0" marginheight="0" frameborder="0" style="width:100%;"></iframe>
+
+
 <p><span class="lh2"><a name="androidFooter"></a></span>
 
         </div>
@@ -239,7 +255,7 @@
     pageTracker._trackPageview(); 
   } catch(e) {}
 </script>
-<div id="jd-build-id"> v0.3 - 9 June 2008</div>
+<div id="jd-build-id"> v0.6 - 25 November 2008</div>
 </div></div></div></body>
 </html>