Merge "version bump for new release   (please don't merge)" into gingerbread
diff --git a/core/Makefile b/core/Makefile
index 72d4ae7..a0961a8 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -15,15 +15,18 @@
 # <dest file> is relative to $(PRODUCT_OUT), so it should look like,
 # e.g., "system/etc/file.xml".
 # The filter part means "only eval the copy-one-file rule if this
-# src:dest pair is the first one to match %:dest"
+# src:dest pair is the first one to match the same dest"
+unique_product_copy_files_destinations := $(sort \
+    $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
 $(foreach cf,$(PRODUCT_COPY_FILES), \
-  $(eval _src := $(call word-colon,1,$(cf))) \
-  $(eval _dest := $(call word-colon,2,$(cf))) \
-  $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
-  $(if $(filter $(_src):$(_dest),$(firstword $(filter %:$(_dest),$(PRODUCT_COPY_FILES)))), \
-    $(eval $(call copy-one-file,$(_src),$(_fulldest))),) \
-  $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
- )
+    $(eval _src := $(call word-colon,1,$(cf))) \
+    $(eval _dest := $(call word-colon,2,$(cf))) \
+    $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
+        $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
+        $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
+        $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
+        $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
+            $(unique_product_copy_files_destinations)))))
 
 # -----------------------------------------------------------------
 # docs/index.html
@@ -277,12 +280,15 @@
 
 event_log_tags_file := $(TARGET_OUT)/etc/event-log-tags
 
-# Include tags from all packages included in this product.
+# Include tags from all packages included in this product, plus all
+# tags that are part of the system (ie, not in a vendor/ or device/
+# directory).
 event_log_tags_src := \
     $(sort $(foreach m,\
       $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES) \
       $(call module-names-for-tag-list,user), \
-      $(ALL_MODULES.$(m).EVENT_LOG_TAGS)))
+      $(ALL_MODULES.$(m).EVENT_LOG_TAGS)) \
+      $(filter-out vendor/% device/% out/%,$(all_event_log_tags_src)))
 
 $(event_log_tags_file): PRIVATE_SRC_FILES := $(event_log_tags_src)
 $(event_log_tags_file): PRIVATE_MERGED_FILE := $(all_event_log_tags_file)
@@ -1022,6 +1028,7 @@
 ifneq ($(TARGET_PRODUCT),sdk)
 ifneq ($(TARGET_DEVICE),generic)
 ifneq ($(TARGET_NO_KERNEL),true)
+ifneq ($(recovery_fstab),)
 
 # -----------------------------------------------------------------
 # OTA update package
@@ -1074,6 +1081,7 @@
 .PHONY: updatepackage
 updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
 
+endif    # recovery_fstab is defined
 endif    # TARGET_NO_KERNEL != true
 endif    # TARGET_DEVICE != generic
 endif    # TARGET_PRODUCT != sdk
diff --git a/core/main.mk b/core/main.mk
index 81bebc8..3ec3189 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -446,6 +446,8 @@
 subdirs := \
 	bionic \
 	system/core \
+	system/extras/ext4_utils \
+	system/extras/su \
 	build/libs \
 	build/target \
 	build/tools/acp \
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index 62adeee..9133312 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -27,10 +27,23 @@
 sdk_addon_deps :=
 files_to_copy :=
 
+define stub-addon-jar-file
+$(subst .jar,_stub-addon.jar,$(1))
+endef
+
+define stub-addon-jar
+$(call stub-addon-jar-file,$(1)): $(1) | mkstubs
+	$(info Stubbing addon jar using $(PRODUCT_SDK_ADDON_STUB_DEFS))
+	$(hide) java -jar $(call module-installed-files,mkstubs) $(if $(hide),,--v) \
+		"$$<" "$$@" @$(PRODUCT_SDK_ADDON_STUB_DEFS)
+endef
+
 # Files that are built and then copied into the sdk-addon
 ifneq ($(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_COPY_MODULES)),)
 $(foreach cf,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SDK_ADDON_COPY_MODULES), \
   $(eval _src := $(call module-stubs-files,$(call word-colon,1,$(cf)))) \
+  $(eval $(call stub-addon-jar,$(_src))) \
+  $(eval _src := $(call stub-addon-jar-file,$(_src))) \
   $(if $(_src),,$(eval $(error Unknown or unlinkable module: $(call word-colon,1,$(cf)). Requested by $(INTERNAL_PRODUCT)))) \
   $(eval _dest := $(call word-colon,2,$(cf))) \
   $(eval files_to_copy += $(_src):$(_dest)) \
diff --git a/tools/droiddoc/src/DocFile.java b/tools/droiddoc/src/DocFile.java
index cc7a8cf..180fdcd 100644
--- a/tools/droiddoc/src/DocFile.java
+++ b/tools/droiddoc/src/DocFile.java
@@ -129,7 +129,7 @@
         } else {
             if (outfile.indexOf("sdk/") != -1) {
                 hdf.setValue("sdk", "true");
-                if ((outfile.indexOf("index.html") != -1) || (outfile.indexOf("features.html") != -1)) {
+                if ((outfile.indexOf("index.html") != -1) && (outfile.indexOf("preview/") == -1)) {
                     ClearPage.write(hdf, "sdkpage.cs", outfile);
                 } else {
                     ClearPage.write(hdf, "docpage.cs", outfile);
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates/assets/android-developer-docs.css
index a574237..1672c93 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates/assets/android-developer-docs.css
@@ -726,34 +726,36 @@
   padding:0;
 }
 
-p.note, p.caution, p.warning {
+p.note, div.note,
+p.caution, div.caution,
+p.warning, div.warning {
   margin: 1em;
   padding: 0 0 0 .5em;
   border-left: 4px solid;
 }
 
-p.special-note {
+p.special-note,
+div.special-note {
   background-color:#EBF3DB;
   padding:10px 20px;
   margin:0 0 1em;
 }
 
-p.note {
+p.note,
+div.note {
  border-color: #99aacc;
 }
 
-p.warning {
+p.warning,
+div.warning {
   border-color: #aa0033;
 }
 
-p.caution {
+p.caution,
+div.caution {
   border-color: #ffcf00;
 }
 
-p.warning b, p.warning strong {
-  font-weight: bold;
-}
-
 li p.note, li p.warning {
   margin: .5em 0 0 0;
   padding: .2em .5em .2em .9em;
diff --git a/tools/droiddoc/templates/assets/android-developer-reference.js b/tools/droiddoc/templates/assets/android-developer-reference.js
index daddde0..31a702b 100644
--- a/tools/droiddoc/templates/assets/android-developer-reference.js
+++ b/tools/droiddoc/templates/assets/android-developer-reference.js
@@ -56,7 +56,7 @@
   if (userApiLevelEnabled == 0) {
     toggleVisisbleApis(selectedLevel, "body");
   } else {
-    selectedLevel = $("#apiLevelSelector option:selected").val();
+    selectedLevel = parseInt($("#apiLevelSelector option:selected").val());
     toggleVisisbleApis(selectedLevel, "body");
     
     var date = new Date();
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index a236a12..74192f7 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -121,10 +121,6 @@
   makeint("boot_size")
 
   d["fstab"] = LoadRecoveryFSTab(zip)
-  if not d["fstab"]:
-    if "fs_type" not in d: d["fs_type"] = "yaffs2"
-    if "partition_type" not in d: d["partition_type"] = "MTD"
-
   return d
 
 def LoadRecoveryFSTab(zip):
@@ -134,9 +130,7 @@
   try:
     data = zip.read("RECOVERY/RAMDISK/etc/recovery.fstab")
   except KeyError:
-    # older target-files that doesn't have a recovery.fstab; fall back
-    # to the fs_type and partition_type keys.
-    return
+    raise ValueError("Could not find RECOVERY/RAMDISK/etc/recovery.fstab")
 
   d = {}
   for line in data.split("\n"):
@@ -350,9 +344,6 @@
     p = info_dict["fstab"][mount_point]
     fs_type = p.fs_type
     limit = info_dict.get(p.device + "_size", None)
-  else:
-    fs_type = info_dict.get("fs_type", None)
-    limit = info_dict.get(target + "_size", None)
   if not fs_type or not limit: return
 
   if fs_type == "yaffs2":
@@ -777,9 +768,4 @@
   if fstab:
     return PARTITION_TYPES[fstab[mount_point].fs_type], fstab[mount_point].device
   else:
-    devices = {"/boot": "boot",
-               "/recovery": "recovery",
-               "/radio": "radio",
-               "/data": "userdata",
-               "/cache": "cache"}
-    return info["partition_type"], info.get("partition_path", "") + devices[mount_point]
+    return None
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 756d673..a7c8e32 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -140,13 +140,6 @@
                          (p.fs_type, common.PARTITION_TYPES[p.fs_type],
                           p.device, p.mount_point))
       self.mounts.add(p.mount_point)
-    else:
-      what = mount_point.lstrip("/")
-      what = self.info.get("partition_path", "") + what
-      self.script.append('mount("%s", "%s", "%s", "%s");' %
-                         (self.info["fs_type"], self.info["partition_type"],
-                          what, mount_point))
-      self.mounts.add(mount_point)
 
   def UnpackPackageDir(self, src, dst):
     """Unpack a given directory from the OTA package into the given
@@ -173,12 +166,6 @@
       p = fstab[partition]
       self.script.append('format("%s", "%s", "%s");' %
                          (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device))
-    else:
-      # older target-files without per-partition types
-      partition = self.info.get("partition_path", "") + partition
-      self.script.append('format("%s", "%s", "%s");' %
-                         (self.info["fs_type"], self.info["partition_type"],
-                          partition))
 
   def DeleteFiles(self, file_list):
     """Delete all files in file_list."""
@@ -231,23 +218,6 @@
             'package_extract_file("%(fn)s", "%(device)s");' % args)
       else:
         raise ValueError("don't know how to write \"%s\" partitions" % (p.fs_type,))
-    else:
-      # backward compatibility with older target-files that lack recovery.fstab
-      if self.info["partition_type"] == "MTD":
-        self.script.append(
-            ('assert(package_extract_file("%(fn)s", "/tmp/%(partition)s.img"),\n'
-             '       write_raw_image("/tmp/%(partition)s.img", "%(partition)s"),\n'
-             '       delete("/tmp/%(partition)s.img"));')
-            % {'partition': partition, 'fn': fn})
-      elif self.info["partition_type"] == "EMMC":
-        self.script.append(
-            ('package_extract_file("%(fn)s", "%(dir)s%(partition)s");')
-            % {'partition': partition, 'fn': fn,
-               'dir': self.info.get("partition_path", ""),
-               })
-      else:
-        raise ValueError("don't know how to write \"%s\" partitions" %
-                         (self.info["partition_type"],))
 
   def SetPermissions(self, fn, uid, gid, mode):
     """Set file ownership and permissions."""