am 387e4d06: LOCAL_LDFLAGS should come after TARGET_GLOBAL_LDFLAGS
diff --git a/core/Makefile b/core/Makefile
index 9cb8c82..78d1c32 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -959,17 +959,9 @@
 
 $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
 
-ifeq ($(TARGET_OTA_SCRIPT_MODE),)
-# default to "auto"
-$(INTERNAL_OTA_PACKAGE_TARGET): scriptmode := auto
-else
-$(INTERNAL_OTA_PACKAGE_TARGET): scriptmode := $(TARGET_OTA_SCRIPT_MODE)
-endif
-
 $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) otatools
 	@echo "Package OTA: $@"
 	$(hide) ./build/tools/releasetools/ota_from_target_files \
-	   -m $(scriptmode) \
 	   -p $(HOST_OUT) \
            -k $(KEY_CERT_PAIR) \
            $(BUILT_TARGET_FILES_PACKAGE) $@
@@ -1072,6 +1064,17 @@
 	$(hide) mkdir -p $(dir $@)
 	$(hide) zip -qj $@ $(TARGET_OUT_APPS)/*
 
+
+#------------------------------------------------------------------
+# A zip of emma code coverage meta files. Generated for fully emma
+# instrumented build.
+#
+EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip
+$(EMMA_META_ZIP): $(INSTALLED_SYSTEMIMAGE)
+	@echo "Collecting Emma coverage meta files."
+	$(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \
+		zip -@ -q $@
+
 endif	# TARGET_SIMULATOR != true
 
 # -----------------------------------------------------------------
diff --git a/core/cleanspec.mk b/core/cleanspec.mk
index d3fc9a4..c32922d 100644
--- a/core/cleanspec.mk
+++ b/core/cleanspec.mk
@@ -184,6 +184,9 @@
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/*)
 $(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/*)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 0fe3c8b..f58e3dd 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -92,6 +92,7 @@
 LOCAL_NO_EMMA_COMPILE:=
 LOCAL_PROGUARD_ENABLED:= # '',optonly,full,custom
 LOCAL_PROGUARD_FLAGS:=
+LOCAL_EMMA_COVERAGE_FILTER:=
 
 # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
 # iterate over thousands of entries every time.
diff --git a/core/definitions.mk b/core/definitions.mk
index 5768c6d..72888ed 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1233,7 +1233,7 @@
     $(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)) \
+    $(addprefix --version-name , $(PLATFORM_VERSION)-$(BUILD_NUMBER)) \
     $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
     $(addprefix --rename-instrumentation-target-package , $(PRIVATE_INSTRUMENTATION_FOR_PACKAGE_NAME))
 endef
@@ -1325,7 +1325,8 @@
 
 define transform-classes.jar-to-emma
 $(hide) java -classpath $(EMMA_JAR) emma instr -outmode fullcopy -outfile \
-    $(PRIVATE_EMMA_COVERAGE_FILE) -ip $< -d $(PRIVATE_EMMA_INTERMEDIATES_DIR)
+    $(PRIVATE_EMMA_COVERAGE_FILE) -ip $< -d $(PRIVATE_EMMA_INTERMEDIATES_DIR) \
+    -ix $(PRIVATE_EMMA_COVERAGE_FILTER)
 endef
 
 #TODO: use a smaller -Xmx value for most libraries;
@@ -1377,7 +1378,7 @@
     $(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)) \
+    $(addprefix --version-name , $(PLATFORM_VERSION)-$(BUILD_NUMBER)) \
     $(addprefix --rename-manifest-package , $(PRIVATE_MANIFEST_PACKAGE_NAME)) \
     $(addprefix --rename-instrumentation-target-package , $(PRIVATE_INSTRUMENTATION_FOR_PACKAGE_NAME)) \
     -F $@
diff --git a/core/java.mk b/core/java.mk
index baa83ee..11b615f 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -63,10 +63,13 @@
 # Choose leaf name for the compiled jar file.
 ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
 full_classes_compiled_jar_leaf := classes-no-debug-var.jar
+built_dex_leaf := classes-no-local.dex
 else
 full_classes_compiled_jar_leaf := classes-full-debug.jar
+built_dex_leaf := classes-with-local.dex
 endif
 full_classes_compiled_jar := $(intermediates.COMMON)/$(full_classes_compiled_jar_leaf)
+built_dex_intermediate := $(intermediates.COMMON)/$(built_dex_leaf)
 
 emma_intermediates_dir := $(intermediates.COMMON)/emma_out
 # the 'lib/$(full_classes_compiled_jar_leaf)' portion of this path is fixed in
@@ -85,7 +88,8 @@
     $(full_classes_full_names_jar) \
     $(full_classes_stubs_jar) \
     $(full_classes_jarjar_jar) \
-    $(built_dex)
+    $(built_dex) \
+    $(built_dex_intermediate)
 
 
 # TODO: It looks like the only thing we need from base_rules is
@@ -154,18 +158,7 @@
 # be done after the inclusion of base_rules.mk.
 ALL_MODULES.$(LOCAL_MODULE).CHECKED := $(full_classes_compiled_jar)
 
-ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
-# If you instrument class files that have local variable debug information in
-# them emma does not correctly maintain the local variable table.
-# This will cause an error when you try to convert the class files for Android.
-# The workaround for this to compile the java classes with only
-# line and source debug information, not local information.
-$(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g:{lines,source}
-else
-# when emma is off, compile with the default flags, which contain full debug
-# info
 $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g
-endif
 
 ifeq ($(LOCAL_IS_STATIC_JAVA_LIBRARY),true)
 # Skip adding emma instrumentation to class files if this is a static library,
@@ -176,6 +169,15 @@
 ifneq ($(LOCAL_NO_EMMA_INSTRUMENT),true)
 $(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILE := $(intermediates.COMMON)/coverage.em
 $(full_classes_emma_jar): PRIVATE_EMMA_INTERMEDIATES_DIR := $(emma_intermediates_dir)
+# module level coverage filter can be defined using LOCAL_EMMA_COVERAGE_FILTER
+# in Android.mk
+ifdef LOCAL_EMMA_COVERAGE_FILTER
+$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := $(LOCAL_EMMA_COVERAGE_FILTER)
+else
+# by default, avoid applying emma instrumentation onto emma classes itself,
+# otherwise there will be exceptions thrown
+$(full_classes_emma_jar): PRIVATE_EMMA_COVERAGE_FILTER := *,-emma,-emmarun,-com.vladium.*
+endif
 # this rule will generate both $(PRIVATE_EMMA_COVERAGE_FILE) and
 # $(full_classes_emma_jar)
 $(full_classes_emma_jar): $(full_classes_compiled_jar) | $(EMMA_JAR)
@@ -252,12 +254,25 @@
 
 ALL_MODULES.$(LOCAL_MODULE).PROGUARD_ENABLED:=$(LOCAL_PROGUARD_ENABLED)
 
+# If you instrument class files that have local variable debug information in
+# them emma does not correctly maintain the local variable table.
+# This will cause an error when you try to convert the class files for Android.
+# The workaround here is to build different dex file here based on emma switch
+# then later copy into classes.dex. When emma is on, dx is run with --no-locals
+# option to remove local variable information
+
 # Override PRIVATE_INTERMEDIATES_DIR so that install-dex-debug
 # will work even when intermediates != intermediates.COMMON.
-$(built_dex): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
-$(built_dex): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
-$(built_dex): $(full_classes_jar) $(DX)
+$(built_dex_intermediate): PRIVATE_INTERMEDIATES_DIR := $(intermediates.COMMON)
+$(built_dex_intermediate): PRIVATE_DX_FLAGS := $(LOCAL_DX_FLAGS)
+ifneq ($(LOCAL_NO_EMMA_COMPILE),true)
+$(built_dex_intermediate): PRIVATE_DX_FLAGS += --no-locals
+endif
+$(built_dex_intermediate): $(full_classes_jar) $(DX)
 	$(transform-classes.jar-to-dex)
+$(built_dex): $(built_dex_intermediate) | $(ACP)
+	@echo Copying: $@
+	$(hide) $(ACP) $< $@
 ifneq ($(GENERATE_DEX_DEBUG),)
 	$(install-dex-debug)
 endif
diff --git a/core/main.mk b/core/main.mk
index 71e8acb..1fd546e 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -705,6 +705,12 @@
 	$(INSTALLED_RAMDISK_TARGET) \
  )
 
+ifeq ($(EMMA_INSTRUMENT),true)
+$(call dist-for-goals, droid, \
+	$(EMMA_META_ZIP) \
+ )
+endif
+
 # Tests are installed in userdata.img.  If we're building the tests
 # variant, copy it for "make tests dist".  Also copy a zip of the
 # contents of userdata.img, so that people can easily extract a
@@ -727,6 +733,20 @@
 	$(SYMBOLS_ZIP) \
  )
 
+.PHONY: samplecode
+sample_MODULES := $(sort $(call get-tagged-modules,samples))
+sample_APKS_DEST_PATH := $(TARGET_COMMON_OUT_ROOT)/samples
+sample_APKS_COLLECTION := \
+        $(foreach module,$(sample_MODULES),$(sample_APKS_DEST_PATH)/$(notdir $(module)))
+$(foreach module,$(sample_MODULES),$(eval $(call \
+        copy-one-file,$(module),$(sample_APKS_DEST_PATH)/$(notdir $(module)))))
+sample_ADDITIONAL_INSTALLED := \
+        $(filter-out $(modules_to_install) $(modules_to_check) $(ALL_PREBUILT),$(sample_MODULES))
+samplecode: $(sample_APKS_COLLECTION)
+	@echo "Collect sample code apks: $^"
+	# remove apks that are not intended to be installed.
+	rm -f $(sample_ADDITIONAL_INSTALLED)
+
 .PHONY: findbugs
 findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
 
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 25de0ea..2c91e48 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -89,6 +89,7 @@
 	    wifi \
 	    vpn \
 	    keystore \
+	    icu4j \
 	 )
 
 #
diff --git a/core/prelink-linux-arm.map b/core/prelink-linux-arm.map
index 5ae1a78..a787888 100644
--- a/core/prelink-linux-arm.map
+++ b/core/prelink-linux-arm.map
@@ -165,3 +165,4 @@
 libtrace_test.so        0x9A300000
 libsrec_jni.so          0x9A200000
 libjpeg.so              0x9A000000
+libbcc.so               0x99C00000
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index d609cee..c17798e 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -41,7 +41,7 @@
   # which is the version that we reveal to the end user.
   # Update this value when the platform version changes (rather
   # than overriding it somewhere else).  Can be an arbitrary string.
-  PLATFORM_VERSION := Kraken
+  PLATFORM_VERSION := Gingerbread
 endif
 
 ifeq "" "$(PLATFORM_SDK_VERSION)"
@@ -59,7 +59,7 @@
 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".
-  PLATFORM_VERSION_CODENAME := Kraken
+  PLATFORM_VERSION_CODENAME := Gingerbread
 endif
 
 ifeq "" "$(DEFAULT_APP_TARGET_SDK)"
diff --git a/envsetup.sh b/envsetup.sh
index 85465b1..8798344 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -29,8 +29,8 @@
         echo "Couldn't locate the top of the tree.  Try setting TOP." >&2
         return
     fi
-    CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
-      make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1
+    (cd $T; CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
+      make --no-print-directory -C "$T" -f build/core/config.mk dumpvar-abs-$1)
 }
 
 # Get the exact value of a build variable.
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 2774968..c51b064 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -30,4 +30,5 @@
     $(LOCAL_DIR)/generic.mk \
     $(LOCAL_DIR)/full.mk \
     $(LOCAL_DIR)/sdk.mk \
-    $(LOCAL_DIR)/sim.mk
+    $(LOCAL_DIR)/sim.mk \
+    $(LOCAL_DIR)/large_emu_hw.mk
diff --git a/target/product/core.mk b/target/product/core.mk
index 97f4b8d..eff4591 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -29,7 +29,6 @@
     Contacts \
     Home \
     HTMLViewer \
-    Phone \
     ApplicationsProvider \
     ContactsProvider \
     DownloadProvider \
diff --git a/target/product/generic.mk b/target/product/generic.mk
index f05c441..c1f286a 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -14,9 +14,11 @@
 # limitations under the License.
 #
 
-# This is a generic product that isn't specialized for a specific device.
+# This is a generic phone product that isn't specialized for a specific device.
 # It includes the base Android platform.
 
+PRODUCT_POLICY := android.policy_phone
+
 PRODUCT_PACKAGES := \
     AccountAndSyncSettings \
     CarHome \
@@ -35,6 +37,7 @@
     Mms \
     Music \
     Provision \
+    Phone \
     Protips \
     QuickSearchBox \
     Settings \
diff --git a/target/product/large_emu_hw.mk b/target/product/large_emu_hw.mk
new file mode 100644
index 0000000..6aadc23
--- /dev/null
+++ b/target/product/large_emu_hw.mk
@@ -0,0 +1,52 @@
+#
+# Copyright (C) 2007 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# This is a generic product for devices with large display but not specialized
+# for a specific device. It includes the base Android platform.
+
+PRODUCT_POLICY := android.policy_mid
+
+PRODUCT_PACKAGES := \
+    AccountAndSyncSettings \
+    CarHome \
+    DeskClock \
+    AlarmProvider \
+    Bluetooth \
+    Calculator \
+    Calendar \
+    Camera \
+    CertInstaller \
+    DrmProvider \
+    Email \
+    Gallery3D \
+    LatinIME \
+    Launcher2 \
+    Mms \
+    Music \
+    Provision \
+    QuickSearchBox \
+    Settings \
+    Sync \
+    Updater \
+    CalendarProvider \
+    SyncProvider
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+
+# Overrides
+PRODUCT_BRAND := generic
+PRODUCT_DEVICE := generic
+PRODUCT_NAME := large_emu_hw
diff --git a/target/product/locales_full.mk b/target/product/locales_full.mk
new file mode 100644
index 0000000..f46caeb
--- /dev/null
+++ b/target/product/locales_full.mk
@@ -0,0 +1,5 @@
+# The locales from the ICU "-large.dat" data set.
+# See external/icu4c/stubdata.
+# This is distinct from "languages_full.mk", which contains those locales for
+# which we have translations. If you like, this file is i18n rather than l18n.
+PRODUCT_LOCALES := cs_CZ da_DA de_AT de_CH de_DE de_LI el_GR en_AU en_CA en_GB en_NZ en_SG en_US es_ES fr_CA fr_CH fr_BE fr_FR it_CH it_IT ja_JP ko_KR nb_NO nl_BE nl_NL pl_PL pt_PT ru_RU sv_SV tr_TR zh_CN zh_HK zh_TW
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 4fe9a74..03e0fe8 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -14,6 +14,7 @@
 # limitations under the License.
 #
 
+PRODUCT_POLICY := android.policy_phone
 PRODUCT_PROPERTY_OVERRIDES :=
 
 PRODUCT_PACKAGES := \
@@ -39,6 +40,7 @@
 	sqlite3 \
 	LatinIME \
 	PinyinIME \
+	Phone \
 	OpenWnn \
 	libWnnEngDic \
 	libWnnJpnDic \
@@ -60,40 +62,13 @@
 
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
 
+$(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk)
+
 # Overrides
 PRODUCT_BRAND := generic
 PRODUCT_NAME := sdk
 PRODUCT_DEVICE := generic
-PRODUCT_LOCALES := \
-	ldpi \
-	hdpi \
-	mdpi \
-	en_US \
-	en_GB \
-	en_CA \
-	en_AU \
-	en_NZ \
-	en_SG \
-	ja_JP \
-	fr_FR \
-	fr_BE \
-	fr_CA \
-	fr_CH \
-	it_IT \
-	it_CH \
-	es_ES \
-	de_DE \
-	de_AT \
-	de_CH \
-	de_LI \
-	nl_NL \
-	nl_BE \
-	cs_CZ \
-	pl_PL \
-	zh_CN \
-	zh_TW \
-	ru_RU \
-	ko_KR
+PRODUCT_LOCALES += ldpi hdpi mdpi
 
 # include available languages for TTS in the system image
 include external/svox/pico/lang/PicoLangDeDeInSystem.mk
diff --git a/target/product/sim.mk b/target/product/sim.mk
index 51b3676..09722d6 100644
--- a/target/product/sim.mk
+++ b/target/product/sim.mk
@@ -1,6 +1,6 @@
 $(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk)
 
 # Overrides
 PRODUCT_NAME := sim
 PRODUCT_DEVICE := sim
-PRODUCT_LOCALES := en_US
diff --git a/tools/apicheck/src/com/android/apicheck/ApiCheck.java b/tools/apicheck/src/com/android/apicheck/ApiCheck.java
index c8272dd..b2f2265 100644
--- a/tools/apicheck/src/com/android/apicheck/ApiCheck.java
+++ b/tools/apicheck/src/com/android/apicheck/ApiCheck.java
@@ -107,6 +107,7 @@
             xmlreader.parse(new InputSource(fileReader));
             ApiInfo apiInfo = handler.getApi();
             apiInfo.resolveSuperclasses();
+            apiInfo.resolveInterfaces();
             return apiInfo;
         } catch (SAXParseException e) {
             Errors.error(Errors.PARSE_ERROR,
diff --git a/tools/apicheck/src/com/android/apicheck/ApiInfo.java b/tools/apicheck/src/com/android/apicheck/ApiInfo.java
index c237814..47b9a15 100644
--- a/tools/apicheck/src/com/android/apicheck/ApiInfo.java
+++ b/tools/apicheck/src/com/android/apicheck/ApiInfo.java
@@ -31,14 +31,13 @@
         return mAllClasses.get(name);
     }
 
-    private void resolveInterfaces() {
+    public void resolveInterfaces() {
         for (ClassInfo c : mAllClasses.values()) {
             c.resolveInterfaces(this);
         }
     }
     
     public boolean isConsistent(ApiInfo otherApi) {
-        resolveInterfaces();
         boolean consistent = true;
         for (PackageInfo pInfo : mPackages.values()) {
             if (otherApi.getPackages().containsKey(pInfo.name())) {
diff --git a/tools/apicheck/src/com/android/apicheck/ClassInfo.java b/tools/apicheck/src/com/android/apicheck/ClassInfo.java
index e62a3d0..2555ea4 100644
--- a/tools/apicheck/src/com/android/apicheck/ClassInfo.java
+++ b/tools/apicheck/src/com/android/apicheck/ClassInfo.java
@@ -135,11 +135,7 @@
             consistent = false;
         }
         for (String iface : mInterfaceNames) {
-            boolean found = false;
-            for (ClassInfo c = cl; c != null && !found; c = c.mSuperClass) {
-                found = c.mInterfaceNames.contains(iface);
-            }
-            if (!found) {
+            if (!implementsInterface(cl, iface)) {
                 Errors.error(Errors.REMOVED_INTERFACE, cl.position(),
                         "Class " + qualifiedName() + " no longer implements " + iface);
             }
@@ -274,6 +270,26 @@
         return consistent;
     }
 
+    /**
+     * Returns true if {@code cl} implements the interface {@code iface} either
+     * by either being that interface, implementing that interface or extending
+     * a type that implements the interface.
+     */
+    private boolean implementsInterface(ClassInfo cl, String iface) {
+        if (cl.qualifiedName().equals(iface)) {
+            return true;
+        }
+        for (ClassInfo clImplements : cl.mInterfaces) {
+            if (implementsInterface(clImplements, iface)) {
+                return true;
+            }
+        }
+        if (cl.mSuperClass != null && implementsInterface(cl.mSuperClass, iface)) {
+            return true;
+        }
+        return false;
+    }
+
     public void resolveInterfaces(ApiInfo apiInfo) {
         for (String interfaceName : mInterfaceNames) {
             mInterfaces.add(apiInfo.findClass(interfaceName));
diff --git a/tools/droiddoc/templates-pdk/customization.cs b/tools/droiddoc/templates-pdk/customization.cs
index 3e9be06..3d80cc8 100644
--- a/tools/droiddoc/templates-pdk/customization.cs
+++ b/tools/droiddoc/templates-pdk/customization.cs
@@ -11,7 +11,6 @@
                       elif:doc.type == "source" ?>source<?cs
                       elif:doc.type == "porting" ?>porting<?cs
                       elif:doc.type == "compatibility" ?>compatibility<?cs
-                      elif:doc.type == "downloads" ?>downloads<?cs
                       elif:doc.type == "community" ?>community<?cs
                       elif:doc.type == "about" ?>about<?cs /if ?>">
               <li id="home-link"><a href="<?cs var:toroot ?>index.html"><span>Home</span></a></li>
@@ -23,8 +22,6 @@
                                   onClick="return loadLast('compatibility')"><span>Compatibility</span></a></li>
               <li id="community-link"><a href="<?cs var:toroot ?>community/index.html"
                                   onClick="return loadLast('community')"><span>Community</span></a></li>
-              <li id="downloads-link"><a href="<?cs var:toroot ?>downloads/index.html"
-                                  onClick="return loadLast('downloads')"><span>Downloads</span></a></li>
               <li id="about-link"><a href="<?cs var:toroot ?>about/index.html"
                                   onClick="return loadLast('about')"><span>About</span></a></li>
           </ul> 
@@ -102,21 +99,6 @@
   </div>
 <?cs /def ?>
 
-<?cs def:downloads_nav() ?>
-  <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/downloads/downloads_toc.cs" ?>
-      </div>
-    </div> <!-- end side-nav -->
-    <script>
-      addLoadEvent(function() {
-        scrollIntoView("devdoc-nav");
-        });
-    </script>
-  </div>
-<?cs /def ?>
-
 <?cs def:compatibility_nav() ?>
   <div class="g-section g-tpl-240" id="body-content">
     <div class="g-unit g-first side-nav-resizable" id="side-nav">
@@ -140,8 +122,6 @@
       <?cs call:porting_nav() ?>
     <?cs elif:doc.type == "compatibility" ?>
       <?cs call:compatibility_nav() ?>
-    <?cs elif:doc.type == "downloads" ?>
-      <?cs call:downloads_nav() ?>
     <?cs elif:doc.type == "community" ?>
       <?cs call:community_nav() ?>
     <?cs elif:doc.type == "about" ?>
diff --git a/tools/droiddoc/templates-pdk/head_tag.cs b/tools/droiddoc/templates-pdk/head_tag.cs
index 915dc0e..cccbb14 100644
--- a/tools/droiddoc/templates-pdk/head_tag.cs
+++ b/tools/droiddoc/templates-pdk/head_tag.cs
@@ -1,6 +1,6 @@
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
-<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>assets-pdk/favicon.ico" />
+<link rel="shortcut icon" type="image/x-icon" href="<?cs var:toroot ?>assets/favicon.ico" />
 <title><?cs 
   if:page.title ?><?cs 
     var:page.title ?><?cs
@@ -9,7 +9,7 @@
     /if ?> | <?cs
   /if ?>Android Open Source</title>
 <link href="<?cs var:toroot ?>assets/android-developer-docs-devguide.css" rel="stylesheet" type="text/css" />
-<link href="<?cs var:toroot ?>assets-pdk/pdk-local.css" rel="stylesheet" type="text/css" />
+<!-- <link href="<?cs var:toroot ?>assets-pdk/pdk-local.css" rel="stylesheet" type="text/css" /> -->
 <script src="<?cs var:toroot ?>assets/search_autocomplete.js" type="text/javascript"></script>
 <script src="<?cs var:toroot ?>assets/jquery-resizable.min.js" type="text/javascript"></script>
 <script src="<?cs var:toroot ?>assets/android-developer-docs.js" type="text/javascript"></script>
@@ -28,7 +28,7 @@
 	}
 }
 </script>
-<script type="text/javascript>
+<script type="text/javascript">
   jQuery(document).ready(function() {
         jQuery("pre").addClass("prettyprint");
   });
diff --git a/tools/releasetools/amend_generator.py b/tools/releasetools/amend_generator.py
deleted file mode 100644
index b543bf7..0000000
--- a/tools/releasetools/amend_generator.py
+++ /dev/null
@@ -1,222 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-
-import common
-
-class AmendGenerator(object):
-  """Class to generate scripts in the 'amend' recovery script language
-  used up through cupcake."""
-
-  def __init__(self):
-    self.script = ['assert compatible_with("0.2") == "true"']
-    self.included_files = set()
-
-  def MakeTemporary(self):
-    """Make a temporary script object whose commands can latter be
-    appended to the parent script with AppendScript().  Used when the
-    caller wants to generate script commands out-of-order."""
-    x = AmendGenerator()
-    x.script = []
-    x.included_files = self.included_files
-    return x
-
-  @staticmethod
-  def _FileRoot(fn):
-    """Convert a file path to the 'root' notation used by amend."""
-    if fn.startswith("/system/"):
-      return "SYSTEM:" + fn[8:]
-    elif fn == "/system":
-      return "SYSTEM:"
-    elif fn.startswith("/tmp/"):
-      return "CACHE:.." + fn
-    else:
-      raise ValueError("don't know root for \"%s\"" % (fn,))
-
-  @staticmethod
-  def _PartitionRoot(partition):
-    """Convert a partition name to the 'root' notation used by amend."""
-    if partition == "userdata":
-      return "DATA:"
-    else:
-      return partition.upper() + ":"
-
-  def AppendScript(self, other):
-    """Append the contents of another script (which should be created
-    with temporary=True) to this one."""
-    self.script.extend(other.script)
-    self.included_files.update(other.included_files)
-
-  def AssertSomeFingerprint(self, *fp):
-    """Assert that the current fingerprint is one of *fp."""
-    x = [('file_contains("SYSTEM:build.prop", '
-          '"ro.build.fingerprint=%s") == "true"') % i for i in fp]
-    self.script.append("assert %s" % (" || ".join(x),))
-
-  def AssertOlderBuild(self, timestamp):
-    """Assert that the build on the device is older (or the same as)
-    the given timestamp."""
-    self.script.append("run_program PACKAGE:check_prereq %s" % (timestamp,))
-    self.included_files.add("check_prereq")
-
-  def AssertDevice(self, device):
-    """Assert that the device identifier is the given string."""
-    self.script.append('assert getprop("ro.product.device") == "%s" || '
-                       'getprop("ro.build.product") == "%s"' % (device, device))
-
-  def AssertSomeBootloader(self, *bootloaders):
-    """Asert that the bootloader version is one of *bootloaders."""
-    self.script.append("assert " +
-                  " || ".join(['getprop("ro.bootloader") == "%s"' % (b,)
-                               for b in bootloaders]))
-
-  def ShowProgress(self, frac, dur):
-    """Update the progress bar, advancing it over 'frac' over the next
-    'dur' seconds."""
-    self.script.append("show_progress %f %d" % (frac, int(dur)))
-
-  def SetProgress(self, frac):
-    """Not implemented in amend."""
-    pass
-
-  def PatchCheck(self, filename, *sha1):
-    """Check that the given file (or MTD reference) has one of the
-    given *sha1 hashes."""
-    out = ["run_program PACKAGE:applypatch -c %s" % (filename,)]
-    for i in sha1:
-      out.append(" " + i)
-    self.script.append("".join(out))
-    self.included_files.add(("applypatch_static", "applypatch"))
-
-  # Not quite right since we don't need to check /cache/saved.file on
-  # failure, but shouldn't hurt.
-  FileCheck = PatchCheck
-
-  def CacheFreeSpaceCheck(self, amount):
-    """Check that there's at least 'amount' space that can be made
-    available on /cache."""
-    self.script.append("run_program PACKAGE:applypatch -s %d" % (amount,))
-    self.included_files.add(("applypatch_static", "applypatch"))
-
-  def Mount(self, kind, what, path):
-    # no-op; amend uses it's 'roots' system to automatically mount
-    # things when they're referred to
-    pass
-
-  def UnpackPackageDir(self, src, dst):
-    """Unpack a given directory from the OTA package into the given
-    destination directory."""
-    dst = self._FileRoot(dst)
-    self.script.append("copy_dir PACKAGE:%s %s" % (src, dst))
-
-  def Comment(self, comment):
-    """Write a comment into the update script."""
-    self.script.append("")
-    for i in comment.split("\n"):
-      self.script.append("# " + i)
-    self.script.append("")
-
-  def Print(self, message):
-    """Log a message to the screen (if the logs are visible)."""
-    # no way to do this from amend; substitute a script comment instead
-    self.Comment(message)
-
-  def FormatPartition(self, partition):
-    """Format the given MTD partition."""
-    self.script.append("format %s" % (self._PartitionRoot(partition),))
-
-  def DeleteFiles(self, file_list):
-    """Delete all files in file_list."""
-    line = []
-    t = 0
-    for i in file_list:
-      i = self._FileRoot(i)
-      line.append(i)
-      t += len(i) + 1
-      if t > 80:
-        self.script.append("delete " + " ".join(line))
-        line = []
-        t = 0
-    if line:
-      self.script.append("delete " + " ".join(line))
-
-  def ApplyPatch(self, srcfile, tgtfile, tgtsize, tgtsha1, *patchpairs):
-    """Apply binary patches (in *patchpairs) to the given srcfile to
-    produce tgtfile (which may be "-" to indicate overwriting the
-    source file."""
-    if len(patchpairs) % 2 != 0:
-      raise ValueError("bad patches given to ApplyPatch")
-    self.script.append(
-        ("run_program PACKAGE:applypatch %s %s %s %d " %
-         (srcfile, tgtfile, tgtsha1, tgtsize)) +
-        " ".join(["%s:%s" % patchpairs[i:i+2]
-                  for i in range(0, len(patchpairs), 2)]))
-    self.included_files.add(("applypatch_static", "applypatch"))
-
-  def WriteFirmwareImage(self, kind, fn):
-    """Arrange to update the given firmware image (kind must be
-    "hboot" or "radio") when recovery finishes."""
-    self.script.append("write_%s_image PACKAGE:%s" % (kind, fn))
-
-  def WriteRawImage(self, partition, fn):
-    """Write the given file into the given MTD partition."""
-    self.script.append("write_raw_image PACKAGE:%s %s" %
-                       (fn, self._PartitionRoot(partition)))
-
-  def SetPermissions(self, fn, uid, gid, mode):
-    """Set file ownership and permissions."""
-    fn = self._FileRoot(fn)
-    self.script.append("set_perm %d %d 0%o %s" % (uid, gid, mode, fn))
-
-  def SetPermissionsRecursive(self, fn, uid, gid, dmode, fmode):
-    """Recursively set path ownership and permissions."""
-    fn = self._FileRoot(fn)
-    self.script.append("set_perm_recursive %d %d 0%o 0%o %s" %
-                       (uid, gid, dmode, fmode, fn))
-
-  def MakeSymlinks(self, symlink_list):
-    """Create symlinks, given a list of (dest, link) pairs."""
-    self.DeleteFiles([i[1] for i in symlink_list])
-    self.script.extend(["symlink %s %s" % (i[0], self._FileRoot(i[1]))
-                        for i in sorted(symlink_list)])
-
-  def AppendExtra(self, extra):
-    """Append text verbatim to the output script."""
-    self.script.append(extra)
-
-  def UnmountAll(self):
-    pass
-
-  def AddToZip(self, input_zip, output_zip, input_path=None):
-    """Write the accumulated script to the output_zip file.  input_zip
-    is used as the source for any ancillary binaries needed by the
-    script.  If input_path is not None, it will be used as a local
-    path for binaries instead of input_zip."""
-    common.ZipWriteStr(output_zip, "META-INF/com/google/android/update-script",
-                       "\n".join(self.script) + "\n")
-    for i in self.included_files:
-      if isinstance(i, tuple):
-        sourcefn, targetfn = i
-      else:
-        sourcefn = i
-        targetfn = i
-      try:
-        if input_path is None:
-          data = input_zip.read(os.path.join("OTA/bin", sourcefn))
-        else:
-          data = open(os.path.join(input_path, sourcefn)).read()
-        common.ZipWriteStr(output_zip, targetfn, data, perms=0755)
-      except (IOError, KeyError), e:
-        raise ExternalError("unable to include binary %s: %s" % (i, e))
diff --git a/tools/releasetools/both_generator.py b/tools/releasetools/both_generator.py
deleted file mode 100644
index 4ae8d50..0000000
--- a/tools/releasetools/both_generator.py
+++ /dev/null
@@ -1,62 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import edify_generator
-import amend_generator
-
-class BothGenerator(object):
-  def __init__(self, version):
-    self.version = version
-    self.edify = edify_generator.EdifyGenerator(version)
-    self.amend = amend_generator.AmendGenerator()
-
-  def MakeTemporary(self):
-    x = BothGenerator(self.version)
-    x.edify = self.edify.MakeTemporary()
-    x.amend = self.amend.MakeTemporary()
-    return x
-
-  def AppendScript(self, other):
-    self.edify.AppendScript(other.edify)
-    self.amend.AppendScript(other.amend)
-
-  def _DoBoth(self, name, *args):
-    getattr(self.edify, name)(*args)
-    getattr(self.amend, name)(*args)
-
-  def AssertSomeFingerprint(self, *a): self._DoBoth("AssertSomeFingerprint", *a)
-  def AssertOlderBuild(self, *a): self._DoBoth("AssertOlderBuild", *a)
-  def AssertDevice(self, *a): self._DoBoth("AssertDevice", *a)
-  def AssertSomeBootloader(self, *a): self._DoBoth("AssertSomeBootloader", *a)
-  def ShowProgress(self, *a): self._DoBoth("ShowProgress", *a)
-  def PatchCheck(self, *a): self._DoBoth("PatchCheck", *a)
-  def FileCheck(self, filename, *sha1): self._DoBoth("FileCheck", *a)
-  def CacheFreeSpaceCheck(self, *a): self._DoBoth("CacheFreeSpaceCheck", *a)
-  def Mount(self, *a): self._DoBoth("Mount", *a)
-  def UnpackPackageDir(self, *a): self._DoBoth("UnpackPackageDir", *a)
-  def Comment(self, *a): self._DoBoth("Comment", *a)
-  def Print(self, *a): self._DoBoth("Print", *a)
-  def FormatPartition(self, *a): self._DoBoth("FormatPartition", *a)
-  def DeleteFiles(self, *a): self._DoBoth("DeleteFiles", *a)
-  def ApplyPatch(self, *a): self._DoBoth("ApplyPatch", *a)
-  def WriteFirmwareImage(self, *a): self._DoBoth("WriteFirmwareImage", *a)
-  def WriteRawImage(self, *a): self._DoBoth("WriteRawImage", *a)
-  def SetPermissions(self, *a): self._DoBoth("SetPermissions", *a)
-  def SetPermissionsRecursive(self, *a): self._DoBoth("SetPermissionsRecursive", *a)
-  def MakeSymlinks(self, *a): self._DoBoth("MakeSymlinks", *a)
-  def AppendExtra(self, *a): self._DoBoth("AppendExtra", *a)
-  def UnmountAll(self, *a): self._DoBoth("UnmountAll", *a)
-
-  def AddToZip(self, input_zip, output_zip, input_path=None):
-    self._DoBoth("AddToZip", input_zip, output_zip, input_path)
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index ba29f9b..a50f452 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -44,10 +44,6 @@
   -e  (--extra_script)  <file>
       Insert the contents of file at the end of the update script.
 
-  -m  (--script_mode)  <mode>
-      Specify 'amend' or 'edify' scripts, or 'auto' to pick
-      automatically (this is the default).
-
 """
 
 import sys
@@ -68,9 +64,7 @@
 import zipfile
 
 import common
-import amend_generator
 import edify_generator
-import both_generator
 
 OPTIONS = common.OPTIONS
 OPTIONS.package_key = "build/target/product/security/testkey"
@@ -81,7 +75,6 @@
 OPTIONS.wipe_user_data = False
 OPTIONS.omit_prereq = False
 OPTIONS.extra_script = None
-OPTIONS.script_mode = 'auto'
 OPTIONS.worker_threads = 3
 
 def MostPopularKey(d, default):
@@ -343,15 +336,10 @@
 
 
 def WriteFullOTAPackage(input_zip, output_zip):
-  if OPTIONS.script_mode == "auto":
-    script = both_generator.BothGenerator(2)
-  elif OPTIONS.script_mode == "amend":
-    script = amend_generator.AmendGenerator()
-  else:
-    # TODO: how to determine this?  We don't know what version it will
-    # be installed on top of.  For now, we expect the API just won't
-    # change very often.
-    script = edify_generator.EdifyGenerator(2)
+  # TODO: how to determine this?  We don't know what version it will
+  # be installed on top of.  For now, we expect the API just won't
+  # change very often.
+  script = edify_generator.EdifyGenerator(3)
 
   device_specific = common.DeviceSpecificParams(
       input_zip=input_zip,
@@ -574,20 +562,10 @@
   source_version = GetRecoveryAPIVersion(source_zip)
   target_version = GetRecoveryAPIVersion(target_zip)
 
-  if OPTIONS.script_mode == 'amend':
-    script = amend_generator.AmendGenerator()
-  elif OPTIONS.script_mode == 'edify':
-    if source_version == 0:
-      print ("WARNING: generating edify script for a source that "
-             "can't install it.")
-    script = edify_generator.EdifyGenerator(source_version)
-  elif OPTIONS.script_mode == 'auto':
-    if source_version > 0:
-      script = edify_generator.EdifyGenerator(source_version)
-    else:
-      script = amend_generator.AmendGenerator()
-  else:
-    raise ValueError('unknown script mode "%s"' % (OPTIONS.script_mode,))
+  if source_version == 0:
+    print ("WARNING: generating edify script for a source that "
+           "can't install it.")
+  script = edify_generator.EdifyGenerator(source_version)
 
   device_specific = common.DeviceSpecificParams(
       source_zip=source_zip,
@@ -835,8 +813,6 @@
       OPTIONS.omit_prereq = True
     elif o in ("-e", "--extra_script"):
       OPTIONS.extra_script = a
-    elif o in ("-m", "--script_mode"):
-      OPTIONS.script_mode = a
     elif o in ("--worker_threads"):
       OPTIONS.worker_threads = int(a)
     else:
@@ -844,14 +820,13 @@
     return True
 
   args = common.ParseOptions(argv, __doc__,
-                             extra_opts="b:k:i:d:wne:m:",
+                             extra_opts="b:k:i:d:wne:",
                              extra_long_opts=["board_config=",
                                               "package_key=",
                                               "incremental_from=",
                                               "wipe_user_data",
                                               "no_prereq",
                                               "extra_script=",
-                                              "script_mode=",
                                               "worker_threads="],
                              extra_option_handler=option_handler)
 
@@ -859,9 +834,6 @@
     common.Usage(__doc__)
     sys.exit(1)
 
-  if OPTIONS.script_mode not in ("amend", "edify", "auto"):
-    raise ValueError('unknown script mode "%s"' % (OPTIONS.script_mode,))
-
   if OPTIONS.extra_script is not None:
     OPTIONS.extra_script = open(OPTIONS.extra_script).read()