Merge change 1738 into donut

* changes:
  add -e option to add extra commands to OTA script
diff --git a/cleanspec.mk b/cleanspec.mk
index a3d84fa..50a1f1f 100644
--- a/cleanspec.mk
+++ b/cleanspec.mk
@@ -76,6 +76,8 @@
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/com.android.inputmethod.pinyin.lib_intermediates)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/PinyinIMEGoogleService_intermediates)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/telephony)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/obj)
+$(call add-clean-step, rm -f $(PRODUCT_OUT)/system/bin/tcpdump)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/core/combo/linux-arm.mk b/core/combo/linux-arm.mk
index b0cc51c..edd2df4 100644
--- a/core/combo/linux-arm.mk
+++ b/core/combo/linux-arm.mk
@@ -4,7 +4,7 @@
 # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
 ifeq ($(strip $($(combo_target)TOOLS_PREFIX)),)
 $(combo_target)TOOLS_PREFIX := \
-	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.3.1/bin/arm-eabi-
+	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-eabi-4.2.1/bin/arm-eabi-
 endif
 
 $(combo_target)CC := $($(combo_target)TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
diff --git a/core/definitions.mk b/core/definitions.mk
index 17ec646..5631fb9 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1122,7 +1122,11 @@
     $(addprefix -P , $(PRIVATE_RESOURCE_PUBLICS_OUTPUT)) \
     $(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
     $(addprefix -A , $(PRIVATE_ASSET_DIR)) \
-    $(addprefix -I , $(PRIVATE_AAPT_INCLUDES))
+    $(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
+    $(addprefix --min-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
+    $(addprefix --target-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
+    $(addprefix --version-code , $(PLATFORM_SDK_VERSION)) \
+    $(addprefix --version-name , $(PLATFORM_VERSION))
 endef
 
 ifeq ($(HOST_OS),windows)
@@ -1250,6 +1254,9 @@
 #      A list of dynamic and static parameters;  build layers for
 #      dynamic params that lay over the static ones.
 #TODO: update the manifest to point to the package file
+#Note that the version numbers are given to aapt as simple default
+#values; applications can override these by explicitly stating
+#them in their manifest.
 define add-assets-to-package
 $(hide) $(AAPT) package -z -u $(PRIVATE_AAPT_FLAGS) \
     $(addprefix -c , $(PRODUCT_AAPT_CONFIG)) \
@@ -1257,6 +1264,10 @@
     $(addprefix -S , $(PRIVATE_RESOURCE_DIR)) \
     $(addprefix -A , $(PRIVATE_ASSET_DIR)) \
     $(addprefix -I , $(PRIVATE_AAPT_INCLUDES)) \
+    $(addprefix --min-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
+    $(addprefix --target-sdk-version , $(DEFAULT_APP_TARGET_SDK)) \
+    $(addprefix --version-code , $(PLATFORM_SDK_VERSION)) \
+    $(addprefix --version-name , $(PLATFORM_VERSION)) \
     -F $@
 endef
 
diff --git a/core/envsetup.mk b/core/envsetup.mk
index ba93549..31901e9 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -7,6 +7,9 @@
 #     OUT_DIR is also set to "out" if it's not already set.
 #         this allows you to set it to somewhere else if you like
 
+# Set up version information.
+include $(BUILD_SYSTEM)/version_defaults.mk
+
 # ---------------------------------------------------------------
 # If you update the build system such that the environment setup
 # or buildspec.mk need to be updated, increment this number, and
@@ -319,6 +322,8 @@
 
 ifneq ($(PRINT_BUILD_CONFIG),)
 $(info ============================================)
+$(info   PLATFORM_VERSION_CODENAME=$(PLATFORM_VERSION_CODENAME))
+$(info   PLATFORM_VERSION=$(PLATFORM_VERSION))
 $(info   TARGET_PRODUCT=$(TARGET_PRODUCT))
 $(info   TARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT))
 $(info   TARGET_SIMULATOR=$(TARGET_SIMULATOR))
diff --git a/core/main.mk b/core/main.mk
index ebd2b9d..655a592 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -85,9 +85,6 @@
 $(error Directory names containing spaces not supported)
 endif
 
-# Set up version information.
-include $(BUILD_SYSTEM)/version_defaults.mk
-
 # These are the modifier targets that don't do anything themselves, but
 # change the behavior of the build.
 # (must be defined before including definitions.make)
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index 902afed..ca8487f 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -20,6 +20,8 @@
 # Guarantees that the following are defined:
 #     PLATFORM_VERSION
 #     PLATFORM_SDK_VERSION
+#     PLATFORM_VERSION_CODENAME
+#     DEFAULT_APP_TARGET_SDK
 #     BUILD_ID
 #     BUILD_NUMBER
 #
@@ -55,11 +57,24 @@
 endif
 
 ifeq "" "$(PLATFORM_VERSION_CODENAME)"
-  # This is the current development code-name, if the build is not a final
-  # release build.  If this is a final release build, it is simply "REL".
+  # If the build is not a final release build, then this is the current
+  # development code-name.  If this is a final release build, it is simply "REL".
   PLATFORM_VERSION_CODENAME := Donut
 endif
 
+ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
+  # This is the default minSdkVersion and targetSdkVersion to use for
+  # all .apks created by the build system.  It can be overridden by explicitly
+  # setting these in the .apk's AndroidManifest.xml.  It is either the code
+  # name of the development build or, if this is a release build, the official
+  # SDK version of this release.
+  ifeq "REL" "$(PLATFORM_VERSION_CODENAME)"
+    DEFAULT_APP_TARGET_SDK := $(PLATFORM_SDK_VERSION)
+  else
+    DEFAULT_APP_TARGET_SDK := $(PLATFORM_VERSION_CODENAME)
+  endif
+endif
+
 ifeq "" "$(BUILD_ID)"
   # Used to signify special builds.  E.g., branches and/or releases,
   # like "M5-RC7".  Can be an arbitrary string, but must be a single
diff --git a/tools/droiddoc/templates-pdk/customization.cs b/tools/droiddoc/templates-pdk/customization.cs
index 8d3cde6..01b6e96 100644
--- a/tools/droiddoc/templates-pdk/customization.cs
+++ b/tools/droiddoc/templates-pdk/customization.cs
@@ -6,7 +6,7 @@
   <div id="header">
       <div id="headerLeft">
           <a href="<?cs var:toroot ?>index.html" tabindex="-1"><img
-              src="<?cs var:toroot ?>assets/images/bg_logo.png" alt="Android Porting Development Kit" /></a>
+              src="<?cs var:toroot ?>assets/images/open_source.png" alt="Open Source Project: Platform Development Kit" /></a>
           <ul class="<?cs 
                   if:reference ?> <?cs
                   elif:guide ?> <?cs
@@ -15,17 +15,10 @@
                   elif:community ?> <?cs
                   elif:publish ?> <?cs
                   elif:about ?> <?cs /if ?>">
-              <li id="home-link"><a href="<?cs var:toroot ?><?cs 
-                  if:android.whichdoc != "online-pdk" ?>offline.html<?cs 
-                  else ?>index.html<?cs /if ?>">
-                  <span>Home</span></a></li>
-              <!--<li id="sdk-link"><a href="<?cs var:toroot ?>index.html"><span>SDK</span></a></li>-->
-              <li id="guide-link"><a href="<?cs var:toroot ?>guide/index.html"
-                                  onClick="return loadLast('guide')"><span>Porting Guide</span></a></li>
-              <!--<li id="reference-link"><a href="<?cs var:toroot ?>reference/packages.html" 
-                                  onClick="return loadLast('reference')"><span>Reference</span></a></li> 
-              <li><a href="http://android-developers.blogspot.com"><span>Blog</span></a></li>
-              <li id="community-link"><a href="<?cs var:toroot ?>community/index.html"><span>Community</span></a></li>-->
+              <li id="guide-link"><a href="<?cs var:toroot ?>index.html"
+                                  onClick="return loadLast('guide)'"><span>Porting Guide</span></a></li>
+              <li id="opensource-link"><a href="http://source.android.com/"
+				 onClick="return loadLast('open')"><span>Open Source</span></a></li>
           </ul> 
       </div>
       <div id="headerRight">
@@ -35,8 +28,7 @@
               <!-- &nbsp;<a href="#">English</a> | -->
               <a href="http://www.android.com">Android.com</a>
             </span>
-          </div><?cs 
-          call:default_search_box() ?>
+          </div>
       </div><!-- headerRight -->
   </div><!-- header --><?cs 
 /def ?><?cs # custom_masthead ?>
@@ -47,7 +39,7 @@
   <div class="g-section g-tpl-240" id="body-content">
     <div class="g-unit g-first side-nav-resizable" id="side-nav">
       <div id="devdoc-nav"><?cs 
-        include:"../../../../development/pdk/docs/html/guide/guide_toc.cs" ?>
+        include:"../../../../development/pdk/docs/guide/pdk_toc.cs" ?>
       </div>
     </div> <!-- end side-nav -->
     <script>
@@ -59,11 +51,7 @@
 
 <?cs 
 def:custom_left_nav() ?><?cs 
-  if:guide ?><?cs 
     call:guide_nav() ?><?cs 
-  else ?><?cs 
-    call:default_left_nav() ?><?cs 
-  /if ?><?cs 
 /def ?>
 
 <?cs # appears at the bottom of every page ?><?cs 
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates/assets/android-developer-docs.css
index b463cb6..004d5cf 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates/assets/android-developer-docs.css
@@ -433,11 +433,11 @@
 .nolist {
   list-style:none;
   padding:0;
-  margin:0 0 0 1em;
+  margin:0 0 1em 1em;
 }
 
 .nolist li {
-  padding:0;
+  padding:0 0 2px;
   margin:0;
 }
 
@@ -594,7 +594,7 @@
 p.caution {
   border-color: #ffcf00;
 }
-  
+
 p.warning b, p.warning strong {
   font-weight: bold;
 }
@@ -672,7 +672,7 @@
 
 #qv ol ol{
   list-style:none;
-  padding: 0 0 3px 12px;
+  padding: 0 0 0 12px;
   margin:0;
 }
 
@@ -681,11 +681,14 @@
 }
 
 #qv li {
-  padding: 0 10px;
-  margin: 2 0 0;
+  padding: 0 10px 3px;
   line-height: 1.2em;
 }
 
+#qv li li {
+  padding: 3px 10px 0;
+}
+
 #qv ul li {
   padding: 0 10px 0 0;
 }
diff --git a/tools/droiddoc/templates/assets/images/open_source.png b/tools/droiddoc/templates/assets/images/open_source.png
new file mode 100755
index 0000000..12bb1fb
--- /dev/null
+++ b/tools/droiddoc/templates/assets/images/open_source.png
Binary files differ
diff --git a/tools/droiddoc/templates/customization.cs b/tools/droiddoc/templates/customization.cs
index 3646495..d437c2c 100644
--- a/tools/droiddoc/templates/customization.cs
+++ b/tools/droiddoc/templates/customization.cs
@@ -9,7 +9,9 @@
           <a href="<?cs var:toroot ?>index.html" tabindex="-1"><?cs var:page.title ?></a>
       </div>
       <div id="headerRight">
-          <?cs call:default_search_box() ?>
+          <?cs if:!online-pdk ?>
+            <?cs call:default_search_box() ?>
+          <?cs /if ?>
       </div><!-- headerRight -->
   </div><!-- header --><?cs 
 /def ?>