Merge change I2bdc7ec9 into eclair

* changes:
  Speed up warn.py about 30x by precompiling all the regular expressions.
diff --git a/buildspec.mk.default b/buildspec.mk.default
index 6fd93da..06db499 100644
--- a/buildspec.mk.default
+++ b/buildspec.mk.default
@@ -21,6 +21,30 @@
 # "buildspec.mk" should never be checked in to source control.
 ######################################################################
 
+# Choose a product to build for.  Look in the products directory for ones
+# that work.
+ifndef TARGET_PRODUCT
+#TARGET_PRODUCT:=generic
+endif
+
+# Choose a variant to build.  If you don't pick one, the default is eng.
+# User is what we ship.  Userdebug is that, with a few flags turned on
+# for debugging.  Eng has lots of extra tools for development.
+ifndef TARGET_BUILD_VARIANT
+#TARGET_BUILD_VARIANT:=user
+#TARGET_BUILD_VARIANT:=userdebug
+#TARGET_BUILD_VARIANT:=eng
+endif
+
+# Choose additional targets to always install, even when building
+# minimal targets like "make droid".  This takes simple target names
+# like "Browser" or "MyApp", the names used by LOCAL_MODULE or
+# LOCAL_PACKAGE_NAME.  Modules listed here will always be installed in
+# /system, even if they'd usually go in /data.
+ifndef CUSTOM_MODULES
+#CUSTOM_MODULES:=
+endif
+
 # Uncomment this if you want the simulator, otherwise, build for arm
 ifndef TARGET_SIMULATOR
 #TARGET_SIMULATOR:=true
@@ -50,21 +74,6 @@
 #HOST_CUSTOM_DEBUG_CFLAGS:=
 #TARGET_CUSTOM_DEBUG_CFLAGS:=
 
-# Choose a product to build for.  Look in the products directory for ones
-# that work.
-ifndef TARGET_PRODUCT
-#TARGET_PRODUCT:=generic
-endif
-
-# Choose additional targets to always install, even when building
-# minimal targets like "make droid".  This takes simple target names
-# like "Browser" or "MyApp", the names used by LOCAL_MODULE or
-# LOCAL_PACKAGE_NAME.  Modules listed here will always be installed in
-# /system, even if they'd usually go in /data.
-ifndef CUSTOM_MODULES
-#CUSTOM_MODULES:=
-endif
-
 # Choose additional locales, like "en_US" or "it_IT", to add to any
 # built product.  Any locales that appear in CUSTOM_LOCALES but not in
 # the locale list for the selected product will be added to the end
diff --git a/cleanspec.mk b/cleanspec.mk
index ff06a56..43d3630 100644
--- a/cleanspec.mk
+++ b/cleanspec.mk
@@ -88,6 +88,10 @@
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libgps_intermediates)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/product/*/system/app/Launcher.apk)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates/src/core/java/android/bluetooth/)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/sholes/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/com.amazon.mp3_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/com.amazon.mp3.apk)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/core/Makefile b/core/Makefile
index db70d2f..e704748 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -814,6 +814,13 @@
 
 $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
 
+ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
+# default to common dir for device vendor
+$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common
+else
+$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
+endif
+
 # Depending on the various images guarantees that the underlying
 # directories are up-to-date.
 $(BUILT_TARGET_FILES_PACKAGE): \
@@ -887,6 +894,7 @@
 	$(hide) echo "recovery $(call image-size-from-data-size,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
 	$(hide) echo "system $(call image-size-from-data-size,$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
 	$(hide) echo "userdata $(call image-size-from-data-size,$(BOARD_USERDATAIMAGE_PARTITION_SIZE))" >> $(zip_root)/META/imagesizes.txt
+	$(hide) echo "$(tool_extensions)" > $(zip_root)/META/tool-extensions.txt
 	@# Zip everything up, preserving symlinks
 	$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
 
@@ -909,13 +917,6 @@
 
 $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
 
-ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
-# default to common dir for device vendor
-$(INTERNAL_OTA_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common
-else
-$(INTERNAL_OTA_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
-endif
-
 ifeq ($(TARGET_OTA_SCRIPT_MODE),)
 # default to "auto"
 $(INTERNAL_OTA_PACKAGE_TARGET): scriptmode := auto
@@ -926,7 +927,7 @@
 $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools
 	@echo "Package OTA: $@"
 	$(hide) ./build/tools/releasetools/ota_from_target_files \
-	   -s $(extensions) -m $(scriptmode) \
+	   -m $(scriptmode) \
 	   -p $(HOST_OUT) \
            -k $(KEY_CERT_PAIR) \
            $(BUILT_TARGET_FILES_PACKAGE) $@
diff --git a/target/product/core.mk b/target/product/core.mk
index 73d4f2e..a93ba7c 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -3,7 +3,7 @@
 PRODUCT_DEVICE :=
 PRODUCT_POLICY := android.policy_phone
 PRODUCT_PROPERTY_OVERRIDES := \
-    ro.config.notification_sound=F1_New_SMS.ogg \
+    ro.config.notification_sound=OnTheHunt.ogg \
     ro.config.alarm_alert=Alarm_Classic.ogg
 
 PRODUCT_PACKAGES := \
diff --git a/target/product/min_dev.mk b/target/product/min_dev.mk
index 3ca762a..92ba973 100644
--- a/target/product/min_dev.mk
+++ b/target/product/min_dev.mk
@@ -1,7 +1,7 @@
 
 PRODUCT_POLICY := android.policy_phone
 PRODUCT_PROPERTY_OVERRIDES := \
-    ro.config.notification_sound=F1_New_SMS.ogg \
+    ro.config.notification_sound=OnTheHunt.ogg \
     ro.config.alarm_alert=Alarm_Classic.ogg
 PRODUCT_BRAND := generic
 PRODUCT_NAME := min_dev
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 92f0b7c..210bd9c 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -25,10 +25,7 @@
 	libwnndict \
 	ApiDemos \
 	GestureBuilder \
-	SoftKeyboard \
-	talkback \
-	soundback \
-	kickback
+	SoftKeyboard
 
 PRODUCT_COPY_FILES := \
 	development/data/etc/vold.conf:system/etc/vold.conf \
@@ -41,6 +38,9 @@
 PRODUCT_NAME := sdk
 PRODUCT_DEVICE := generic
 PRODUCT_LOCALES := \
+	ldpi \
+	hdpi \
+	mdpi \
 	en_US \
 	en_GB \
 	en_CA \
diff --git a/tools/droiddoc/templates-sdk/sdkpage.cs b/tools/droiddoc/templates-sdk/sdkpage.cs
index f1d69fb..328eae1 100644
--- a/tools/droiddoc/templates-sdk/sdkpage.cs
+++ b/tools/droiddoc/templates-sdk/sdkpage.cs
@@ -62,10 +62,10 @@
 <p>The Android NDK is a companion tool to the Android SDK that lets Android
 application developers build performance-critical portions of their apps in
 native code. It is designed for use <em>only</em> in conjunction with the
-Android SDK, so if you have not already installed the Android 1.5 SDK, please do
-so before downloading the NDK. Also, please read <a href="#overview">What is the 
-Android NDK?</a> to get an understanding of what the NDK offers and whether it 
-will be useful to you.</p>
+Android SDK, so if you have not already installed the latest Android SDK, please
+do so before downloading the NDK. Also, please read <a href="#overview">What is 
+the Android NDK?</a> to get an understanding of what the NDK offers and whether
+it will be useful to you.</p>
 
 <p>Select the download package that is appropriate for your development
 computer. </p>
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates/assets/android-developer-docs.css
index d72098f..1e5b51e 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates/assets/android-developer-docs.css
@@ -339,7 +339,6 @@
 }
 
 #api-level-toggle {
-  float:right;
   padding:0 10px;
   font-size:11px;
   color:#999;
diff --git a/tools/droiddoc/templates/macros.cs b/tools/droiddoc/templates/macros.cs
index 6ee9701..8675b5b 100644
--- a/tools/droiddoc/templates/macros.cs
+++ b/tools/droiddoc/templates/macros.cs
@@ -98,8 +98,8 @@
 <?cs # Show the red box with the deprecated warning ?><?cs 
 def:deprecated_warning(obj) ?><?cs 
   if:subcount(obj.deprecated) ?><p>
-  <p class="warning jd-deprecated-warning">
-      <strong><?cs call:deprecated_text(obj.kind) ?></strong><?cs 
+  <p class="caution">
+      <strong><?cs call:deprecated_text(obj.kind) ?></strong><br/> <?cs 
       call:tag_list(obj.deprecated) ?>
   </p><?cs 
   /if ?><?cs 
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index e758deb..27264dd 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -440,7 +440,7 @@
 
     if self.module is None:
       path = OPTIONS.device_specific
-      if path is None: return
+      if not path: return
       try:
         if os.path.isdir(path):
           info = imp.find_module("releasetools", [path])
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index cbae34c..e719696 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -57,6 +57,7 @@
   sys.exit(1)
 
 import copy
+import errno
 import os
 import re
 import sha
@@ -517,7 +518,7 @@
           print "%8.2f sec %8d / %8d bytes (%6.2f%%) %s" % (
               dur, len(patch), tf.size, 100.0 * len(patch) / tf.size, name)
       lock.release()
-    except e:
+    except Exception, e:
       print e
       raise
 
@@ -855,6 +856,23 @@
   print "unzipping target target-files..."
   OPTIONS.input_tmp = common.UnzipTemp(args[0])
 
+  if OPTIONS.device_specific is None:
+    # look for the device-specific tools extension location in the input
+    try:
+      f = open(os.path.join(OPTIONS.input_tmp, "META", "tool-extensions.txt"))
+      ds = f.read().strip()
+      f.close()
+      if ds:
+        ds = os.path.normpath(ds)
+        print "using device-specific extensions in", ds
+        OPTIONS.device_specific = ds
+    except IOError, e:
+      if e.errno == errno.ENOENT:
+        # nothing specified in the file
+        pass
+      else:
+        raise
+
   common.LoadMaxSizes()
   if not OPTIONS.max_image_size:
     print
diff --git a/tools/zipalign/README.txt b/tools/zipalign/README.txt
index a2e1a5e..9c7d07e 100644
--- a/tools/zipalign/README.txt
+++ b/tools/zipalign/README.txt
@@ -1,7 +1,9 @@
 zipalign -- zip archive alignment tool
 
 usage: zipalign [-f] [-v] <align> infile.zip outfile.zip
+       zipalign -c [-v] <align> infile.zip
 
+  -c : check alignment only (does not modify file)
   -f : overwrite existing outfile.zip
   -v : verbose output
   <align> is in bytes, e.g. "4" provides 32-bit alignment
@@ -29,3 +31,5 @@
 By default, zipalign will not overwrite an existing output file.  With the
 "-f" flag, an existing file will be overwritten.
 
+You can use the "-c" flag to test whether a zip archive is properly aligned.
+
diff --git a/tools/zipalign/ZipAlign.cpp b/tools/zipalign/ZipAlign.cpp
index eab2f04..c2d8159 100644
--- a/tools/zipalign/ZipAlign.cpp
+++ b/tools/zipalign/ZipAlign.cpp
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 /*
  * Zip alignment tool
  */
@@ -29,9 +30,15 @@
 void usage(void)
 {
     fprintf(stderr, "Zip alignment utility\n");
+    fprintf(stderr, "Copyright (C) 2009 The Android Open Source Project\n\n");
     fprintf(stderr,
         "Usage: zipalign [-f] [-v] <align> infile.zip outfile.zip\n"
-        "       zipalign -c [-v] <align> infile.zip\n" );
+        "       zipalign -c [-v] <align> infile.zip\n\n" );
+    fprintf(stderr,
+        "  <align>: alignment in bytes, e.g. '4' provides 32-bit alignment\n");
+    fprintf(stderr, "  -c: check alignment only (does not modify file)\n");
+    fprintf(stderr, "  -f: overwrite existing outfile.zip\n");
+    fprintf(stderr, "  -v: verbose output\n");
 }
 
 /*