Merge change 26258 into eclair

* changes:
  docs only. remove Home tab from offline docs and make SDK tab point to new offline welcome page; hide all other languages by default instead of depending on the stylesheet
diff --git a/cleanspec.mk b/cleanspec.mk
index db72541..ff06a56 100644
--- a/cleanspec.mk
+++ b/cleanspec.mk
@@ -82,6 +82,12 @@
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libwebcore_intermediates)
 $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libwebcore_intermediates)
 $(call add-clean-step, rm -rf $(OUT_DIR)/obj/target/common/obj/APPS/VoiceSearch_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/VoiceSearch_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libgps-rpc_intermediates)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/pdsm_atl_intermediates)
+$(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)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 82c7dec..64b74e7 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -272,8 +272,10 @@
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_OBJECTS := $(patsubst %.java,%.class,$(LOCAL_SRC_FILES))
 ifeq ($(my_prefix),TARGET_)
+ifeq ($(LOCAL_SDK_VERSION),)
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_BOOTCLASSPATH := -bootclasspath $(call java-lib-files,core)
 endif
+endif
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RESOURCE_DIR := $(LOCAL_RESOURCE_DIR)
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_EXTRA_JAR_ARGS := $(extra_jar_args)
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ASSET_DIR := $(LOCAL_ASSET_DIR)
diff --git a/core/definitions.mk b/core/definitions.mk
index a16ce03..297e6b7 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -109,7 +109,14 @@
 
 # Figure out where we are.
 define my-dir
-$(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST),$(MAKEFILE_LIST))))
+$(strip \
+  $(eval md_file_ := $$(lastword $$(MAKEFILE_LIST))) \
+  $(if $(filter $(CLEAR_VARS),$(md_file_)), \
+    $(error LOCAL_PATH must be set before including $$(CLEAR_VARS)) \
+   , \
+    $(patsubst %/,%,$(dir $(md_file_))) \
+   ) \
+ )
 endef
 
 ###########################################################
diff --git a/target/product/generic.mk b/target/product/generic.mk
index dc48702..39f4950 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -9,6 +9,7 @@
     Calculator \
     Calendar \
     Camera \
+    CertInstaller \
     DrmProvider \
     Email \
     LatinIME \
diff --git a/tools/dexpreopt/Config.mk b/tools/dexpreopt/Config.mk
index c6639b2..443b8c9 100644
--- a/tools/dexpreopt/Config.mk
+++ b/tools/dexpreopt/Config.mk
@@ -77,6 +77,13 @@
     $(shell echo "$(p) $(PACKAGES.$(p).CERTIFICATE) $(PACKAGES.$(p).PRIVATE_KEY)" >> $(dexpreopt_package_certs_file)))
 endif
 
+# The kernel used for ARMv7 system images is different
+ifeq ($(TARGET_ARCH_VARIANT),armv7-a)
+BUILD_DEXPREOPT_KERNEL := prebuilt/android-arm/kernel/kernel-qemu-armv7
+else
+BUILD_DEXPREOPT_KERNEL := prebuilt/android-arm/kernel/kernel-qemu
+endif
+
 # Build an optimized image from the unoptimized image
 BUILT_DEXPREOPT_SYSTEMIMAGE := $(intermediates)/system.img
 $(BUILT_DEXPREOPT_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE_UNOPT)
@@ -99,7 +106,7 @@
 	$(hide) \
 	    PATH=$(HOST_OUT_EXECUTABLES):$$PATH \
 	    $(DEXPREOPT) \
-		    --kernel prebuilt/android-arm/kernel/kernel-qemu \
+		    --kernel $(BUILD_DEXPREOPT_KERNEL) \
 		    --ramdisk $(BUILT_DEXPREOPT_RAMDISK) \
 		    --image $(BUILT_SYSTEMIMAGE_UNOPT) \
 		    --system $(PRODUCT_OUT) \
diff --git a/tools/releasetools/amend_generator.py b/tools/releasetools/amend_generator.py
index 70e71d4..f8f4344 100644
--- a/tools/releasetools/amend_generator.py
+++ b/tools/releasetools/amend_generator.py
@@ -87,6 +87,10 @@
     '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."""
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index e7a15cd..d1902e1 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -100,9 +100,16 @@
 
   def ShowProgress(self, frac, dur):
     """Update the progress bar, advancing it over 'frac' over the next
-    'dur' seconds."""
+    'dur' seconds.  'dur' may be zero to advance it via SetProgress
+    commands instead of by time."""
     self.script.append("show_progress(%f, %d);" % (frac, int(dur)))
 
+  def SetProgress(self, frac):
+    """Set the position of the progress bar within the chunk defined
+    by the most recent ShowProgress call.  'frac' should be in
+    [0,1]."""
+    self.script.append("set_progress(%f);" % (frac,))
+
   def PatchCheck(self, filename, *sha1):
     """Check that the given file (or MTD reference) has one of the
     given *sha1 hashes."""
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index fc6a4c6..fe63c3a 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -577,28 +577,27 @@
       os.path.join(OPTIONS.target_tmp, "RECOVERY")))
   updating_recovery = (source_recovery.data != target_recovery.data)
 
-  # We reserve the last 0.3 of the progress bar for the
-  # device-specific IncrementalOTA_InstallEnd() call at the end, which
-  # will typically install a radio image.
-  progress_bar_total = 0.7
-  if updating_boot:
-    progress_bar_total -= 0.1
+  # Here's how we divide up the progress bar:
+  #  0.1 for verifying the start state (PatchCheck calls)
+  #  0.8 for applying patches (ApplyPatch calls)
+  #  0.1 for unpacking verbatim files, symlinking, and doing the
+  #      device-specific commands.
 
   AppendAssertions(script, target_zip)
   device_specific.IncrementalOTA_Assertions()
 
   script.Print("Verifying current system...")
 
-  pb_verify = progress_bar_total * 0.3 * \
-              (total_patched_size /
-               float(total_patched_size+total_verbatim_size+1))
+  script.ShowProgress(0.1, 0)
+  total_verify_size = float(sum([i[2].size for i in patch_list]) + 1)
+  if updating_boot:
+    total_verify_size += source_boot.size
+  so_far = 0
 
-  for i, (fn, tf, sf, size) in enumerate(patch_list):
-    if i % 5 == 0:
-      next_sizes = sum([i[3] for i in patch_list[i:i+5]])
-      script.ShowProgress(next_sizes * pb_verify / (total_patched_size+1), 1)
-
+  for fn, tf, sf, size in patch_list:
     script.PatchCheck("/"+fn, tf.sha1, sf.sha1)
+    so_far += sf.size
+    script.SetProgress(so_far / total_verify_size)
 
   if updating_boot:
     d = Difference(target_boot, source_boot, "imgdiff")
@@ -610,6 +609,8 @@
     script.PatchCheck("MTD:boot:%d:%s:%d:%s" %
                       (source_boot.size, source_boot.sha1,
                        target_boot.size, target_boot.sha1))
+    so_far += source_boot.size
+    script.SetProgress(so_far / total_verify_size)
 
   if patch_list or updating_recovery or updating_boot:
     script.CacheFreeSpaceCheck(largest_source_size)
@@ -630,6 +631,19 @@
                             if i not in target_data] +
                      ["/system/recovery.img"])
 
+  script.ShowProgress(0.8, 0)
+  total_patch_size = float(sum([i[1].size for i in patch_list]) + 1)
+  if updating_boot:
+    total_patch_size += target_boot.size
+  so_far = 0
+
+  script.Print("Patching system files...")
+  for fn, tf, sf, size in patch_list:
+    script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1,
+                      sf.sha1, "/tmp/patchtmp/"+fn+".p")
+    so_far += tf.size
+    script.SetProgress(so_far / total_patch_size)
+
   if updating_boot:
     # Produce the boot image by applying a patch to the current
     # contents of the boot partition, and write it back to the
@@ -641,6 +655,8 @@
                       "-",
                       target_boot.size, target_boot.sha1,
                       source_boot.sha1, "/tmp/patchtmp/boot.img.p")
+    so_far += target_boot.size
+    script.SetProgress(so_far / total_patch_size)
     print "boot image changed; including."
   else:
     print "boot image unchanged; skipping."
@@ -663,16 +679,7 @@
   else:
     print "recovery image unchanged; skipping."
 
-  script.Print("Patching system files...")
-  pb_apply = progress_bar_total * 0.7 * \
-             (total_patched_size /
-              float(total_patched_size+total_verbatim_size+1))
-  for i, (fn, tf, sf, size) in enumerate(patch_list):
-    if i % 5 == 0:
-      next_sizes = sum([i[3] for i in patch_list[i:i+5]])
-      script.ShowProgress(next_sizes * pb_apply / (total_patched_size+1), 1)
-    script.ApplyPatch("/"+fn, "-", tf.size, tf.sha1,
-                      sf.sha1, "/tmp/patchtmp/"+fn+".p")
+  script.ShowProgress(0.1, 10)
 
   target_symlinks = CopySystemFiles(target_zip, None)
 
@@ -700,10 +707,6 @@
   script.DeleteFiles(to_delete)
 
   if verbatim_targets:
-    pb_verbatim = progress_bar_total * \
-                  (total_verbatim_size /
-                   float(total_patched_size+total_verbatim_size+1))
-    script.ShowProgress(pb_verbatim, 5)
     script.Print("Unpacking new files...")
     script.UnpackPackageDir("system", "/system")
 
@@ -726,8 +729,7 @@
   # permissions.
   script.AppendScript(temp_script)
 
-  # Write the radio image, if necessary.
-  script.ShowProgress(0.3, 10)
+  # Do device-specific installation (eg, write radio image).
   device_specific.IncrementalOTA_InstallEnd()
 
   if OPTIONS.extra_script is not None: