auto import from //branches/cupcake/...@127101
diff --git a/cleanspec.mk b/cleanspec.mk
index f7a215b..75f83bf 100644
--- a/cleanspec.mk
+++ b/cleanspec.mk
@@ -58,6 +58,8 @@
 $(call add-clean-step, rm -f $(PRODUCT_OUT)/system/etc/NOTICE.html)
 # Remove generated java files after CL 126153
 $(call add-clean-step, find $(OUT_DIR) -type f -name "*.java" -print0 | xargs -0 rm -f)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/framework_intermediates)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/sapphire/obj/SHARED_LIBRARIES/libhardware_legacy_intermediates/led)
 
 # ************************************************
 # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
diff --git a/core/Makefile b/core/Makefile
index 0d82299..a87f606 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -809,6 +809,11 @@
   fi
 endef
 
+built_ota_tools := \
+ 	$(hide) $(ACP) $(call intermediates-dir-for,EXECUTABLES,applypatch)/applypatch \
+	$(hide) $(ACP) $(call intermediates-dir-for,EXECUTABLES,check_prereq)/check_prereq
+$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
+
 # Depending on the various images guarantees that the underlying
 # directories are up-to-date.
 $(BUILT_TARGET_FILES_PACKAGE): \
@@ -820,6 +825,7 @@
 		$(INSTALLED_USERDATAIMAGE_TARGET) \
 		$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
 		$(INTERNAL_OTA_SCRIPT_TARGET) \
+		$(built_ota_tools) \
 		$(APKCERTS_FILE) \
 		| $(ACP)
 	@echo "Package target files: $@"
@@ -865,10 +871,11 @@
 	$(hide) $(call package_files-copy-root, \
 		$(TARGET_OUT_DATA),$(zip_root)/DATA)
 	@# Extra contents of the OTA package
-	$(hide) mkdir -p $(zip_root)/OTA
+	$(hide) mkdir -p $(zip_root)/OTA/bin
 	$(hide) $(call package_files-copy-root, \
 		$(INTERNAL_OTA_INTERMEDIATES_DIR),$(zip_root)/OTA)
 	$(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/
+	$(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/
 	@# Files that don't end up in any images, but are necessary to
 	@# build them.
 	$(hide) mkdir -p $(zip_root)/META
diff --git a/core/definitions.mk b/core/definitions.mk
index 780d8fb..67f7166 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -243,15 +243,9 @@
 ###########################################################
 
 define find-subdir-assets
-$(if $(1),\
-  $(patsubst ./%,%, $(foreach dir,$(1),\
-    $(shell if [ -d $(dir) ] ; then\
-	 cd $(dir) ; find ./ -type f -and -not -type l ;\
-      fi \
-    ) \
-  )) \
-, \
-  $(warning Empty argument supplied to find-subdir-assets) \
+$(if $(1),$(patsubst ./%,%, \
+	$(shell if [ -d $(1) ] ; then cd $(1) ; find ./ -type f -and -not -type l ; fi)), \
+	$(warning Empty argument supplied to find-subdir-assets) \
 )
 endef
 
diff --git a/core/package.mk b/core/package.mk
index ba41495..32f394f 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -65,9 +65,11 @@
 endif
 
 ifeq (,$(LOCAL_RESOURCE_DIR))
-LOCAL_RESOURCE_DIR := $(wildcard $(addsuffix /$(LOCAL_PATH)/res, $(PRODUCT_PACKAGE_OVERLAYS))) \
-  $(LOCAL_PATH)/res
+  LOCAL_RESOURCE_DIR := $(LOCAL_PATH)/res
 endif
+LOCAL_RESOURCE_DIR := \
+  $(wildcard $(addsuffix /$(LOCAL_RESOURCE_DIR), $(PRODUCT_PACKAGE_OVERLAYS))) \
+  $(LOCAL_RESOURCE_DIR)
 
 # this is an app, so add the system libraries to the search path
 LOCAL_AIDL_INCLUDES += $(FRAMEWORKS_BASE_JAVA_SRC_DIRS)
@@ -77,8 +79,14 @@
 all_assets := $(call find-subdir-assets,$(LOCAL_ASSET_DIR))
 all_assets := $(addprefix $(LOCAL_ASSET_DIR)/,$(patsubst assets/%,%,$(all_assets)))
 
-all_resources := $(call find-subdir-assets,$(LOCAL_RESOURCE_DIR))
-all_resources := $(addprefix $(LOCAL_RESOURCE_DIR)/,$(patsubst res/%,%,$(all_resources)))
+all_resources := $(strip \
+    $(foreach dir, $(LOCAL_RESOURCE_DIR), \
+      $(addprefix $(dir)/, \
+        $(patsubst res/%,%, \
+          $(call find-subdir-assets,$(dir)) \
+         ) \
+       ) \
+     ))
 
 all_res_assets := $(strip $(all_assets) $(all_resources))
 
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 71c2b8a..1bf3c3f 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -27,6 +27,7 @@
 
 PRODUCT_MAKEFILES := \
     $(LOCAL_DIR)/generic.mk \
+    $(LOCAL_DIR)/min_dev.mk \
     $(LOCAL_DIR)/sdk.mk \
     $(LOCAL_DIR)/sim.mk \
     $(LOCAL_DIR)/generic_with_google.mk
diff --git a/target/product/core.mk b/target/product/core.mk
index 534925f..117bb11 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -18,5 +18,6 @@
     MediaProvider \
     SettingsProvider \
     TelephonyProvider \
+    UserDictionaryProvider \
     PackageInstaller \
     Bugreport
diff --git a/target/product/min_dev.mk b/target/product/min_dev.mk
new file mode 100644
index 0000000..34096a3
--- /dev/null
+++ b/target/product/min_dev.mk
@@ -0,0 +1,18 @@
+
+PRODUCT_POLICY := android.policy_phone
+PRODUCT_PROPERTY_OVERRIDES := \
+    ro.config.notification_sound=F1_New_SMS.ogg
+PRODUCT_BRAND := generic
+PRODUCT_NAME := min_dev
+PRODUCT_DEVICE := generic
+
+PRODUCT_PACKAGES := \
+    DownloadProvider \
+    MediaProvider \
+    SettingsProvider \
+    PackageInstaller \
+    Bugreport \
+    Launcher \
+    Settings \
+    sqlite3
+
diff --git a/tools/applypatch/Android.mk b/tools/applypatch/Android.mk
index 725c21f..09f9862 100644
--- a/tools/applypatch/Android.mk
+++ b/tools/applypatch/Android.mk
@@ -17,12 +17,12 @@
 
 ifneq ($(TARGET_SIMULATOR),true)
 
-LOCAL_SRC_FILES := applypatch.c xdelta3.c bsdiff.c freecache.c
+LOCAL_SRC_FILES := applypatch.c bsdiff.c freecache.c
 LOCAL_MODULE := applypatch
 LOCAL_FORCE_STATIC_EXECUTABLE := true
 LOCAL_MODULE_TAGS := eng
-LOCAL_C_INCLUDES += external/xdelta3 external/bzip2
-LOCAL_STATIC_LIBRARIES += libxdelta3 libmincrypt libbz libc
+LOCAL_C_INCLUDES += external/bzip2
+LOCAL_STATIC_LIBRARIES += libmincrypt libbz libc
 
 include $(BUILD_EXECUTABLE)
 
diff --git a/tools/applypatch/applypatch.c b/tools/applypatch/applypatch.c
index 23ed715..9954869 100644
--- a/tools/applypatch/applypatch.c
+++ b/tools/applypatch/applypatch.c
@@ -1,20 +1,17 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * 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
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * 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.
  */
 
 #include <errno.h>
@@ -209,24 +206,6 @@
 }
 
 int ShowLicenses() {
-  puts("\nCopyright (C) 2008 The Android Open Source Project\n"
-       "\n"
-       "This program is free software; you can redistribute it and/or\n"
-       "modify it under the terms of the GNU General Public License\n"
-       "as published by the Free Software Foundation; either version 2\n"
-       "of the License, or (at your option) any later version.\n"
-       "\n"
-       "This program is distributed in the hope that it will be useful,\n"
-       "but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
-       "MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
-       "GNU General Public License for more details.\n"
-       "\n"
-       "You should have received a copy of the GNU General Public License\n"
-       "along with this program; if not, write to the Free Software\n"
-       "Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA\n"
-       "02110-1301, USA.\n"
-       "\n------------------\n"
-       );
   ShowBSDiffLicense();
   return 0;
 }
@@ -251,10 +230,10 @@
 //   successfully.
 //
 // - otherwise, if the sha1 hash of <file> is <src-sha1>, applies the
-//   xdelta3 or bsdiff <patch> to <file> to produce a new file (the
-//   type of patch is automatically detected from the file header).
-//   If that new file has sha1 hash <tgt-sha1>, moves it to replace
-//   <file>, and exits successfully.
+//   bsdiff <patch> to <file> to produce a new file (the type of patch
+//   is automatically detected from the file header).  If that new
+//   file has sha1 hash <tgt-sha1>, moves it to replace <file>, and
+//   exits successfully.
 //
 // - otherwise, or if any error is encountered, exits with non-zero
 //   status.
@@ -426,12 +405,8 @@
       header[2] == 0xc4 && header[3] == 0) {
     // xdelta3 patches begin "VCD" (with the high bits set) followed
     // by a zero byte (the version number).
-    int result = ApplyXDelta3Patch(source_to_use->data, source_to_use->size,
-                                   patch_filename, output, &ctx);
-    if (result != 0) {
-      fprintf(stderr, "ApplyXDelta3Patch failed\n");
-      return result;
-    }
+    fprintf(stderr, "error:  xdelta3 patches no longer supported\n");
+    return 1;
   } else if (header_bytes_read >= 8 &&
              memcmp(header, "BSDIFF40", 8) == 0) {
     int result = ApplyBSDiffPatch(source_to_use->data, source_to_use->size,
diff --git a/tools/applypatch/applypatch.h b/tools/applypatch/applypatch.h
index 3059e22..76fc80a 100644
--- a/tools/applypatch/applypatch.h
+++ b/tools/applypatch/applypatch.h
@@ -1,20 +1,17 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * 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
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * 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.
  */
 
 #ifndef _APPLYPATCH_H
@@ -44,11 +41,6 @@
 // applypatch.c
 size_t FreeSpaceForFile(const char* filename);
 
-// xdelta3.c
-int ApplyXDelta3Patch(const unsigned char* old_data, ssize_t old_size,
-                      const char* patch_filename,
-                      FILE* output, SHA_CTX* ctx);
-
 // bsdiff.c
 void ShowBSDiffLicense();
 int ApplyBSDiffPatch(const unsigned char* old_data, ssize_t old_size,
diff --git a/tools/applypatch/applypatch.sh b/tools/applypatch/applypatch.sh
index 193e7fd..181cd5c 100755
--- a/tools/applypatch/applypatch.sh
+++ b/tools/applypatch/applypatch.sh
@@ -128,7 +128,7 @@
 # --------------- apply patch ----------------------
 
 $ADB push $DATA_DIR/old.file $WORK_DIR
-$ADB push $DATA_DIR/patch.xdelta3 $WORK_DIR
+$ADB push $DATA_DIR/patch.bsdiff $WORK_DIR
 
 # Check that the partition has enough space to apply the patch without
 # copying.  If it doesn't, we'll be testing the low-space condition
@@ -145,19 +145,6 @@
   exit 1
 fi
 
-testname "apply xdelta3 patch"
-run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.xdelta3 || fail
-$ADB pull $WORK_DIR/old.file $tmpdir/patched
-diff -q $DATA_DIR/new.file $tmpdir/patched || fail
-
-testname "reapply xdelta3 patch"
-run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.xdelta3 || fail
-$ADB pull $WORK_DIR/old.file $tmpdir/patched
-diff -q $DATA_DIR/new.file $tmpdir/patched || fail
-
-$ADB push $DATA_DIR/old.file $WORK_DIR
-$ADB push $DATA_DIR/patch.bsdiff $WORK_DIR
-
 testname "apply bsdiff patch"
 run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.bsdiff || fail
 $ADB pull $WORK_DIR/old.file $tmpdir/patched
@@ -172,7 +159,6 @@
 # --------------- apply patch with low space on /system ----------------------
 
 $ADB push $DATA_DIR/old.file $WORK_DIR
-$ADB push $DATA_DIR/patch.xdelta3 $WORK_DIR
 $ADB push $DATA_DIR/patch.bsdiff $WORK_DIR
 
 free_kb=$(free_space $WORK_FS)
@@ -182,18 +168,6 @@
 free_kb=$(free_space $WORK_FS)
 echo "${free_kb}kb free on /$WORK_FS now."
 
-testname "apply xdelta3 patch with low space"
-run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.xdelta3 || fail
-$ADB pull $WORK_DIR/old.file $tmpdir/patched
-diff -q $DATA_DIR/new.file $tmpdir/patched || fail
-
-testname "reapply xdelta3 patch with low space"
-run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.xdelta3 || fail
-$ADB pull $WORK_DIR/old.file $tmpdir/patched
-diff -q $DATA_DIR/new.file $tmpdir/patched || fail
-
-$ADB push $DATA_DIR/old.file $WORK_DIR
-
 testname "apply bsdiff patch with low space"
 run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.bsdiff || fail
 $ADB pull $WORK_DIR/old.file $tmpdir/patched
@@ -207,7 +181,6 @@
 # --------------- apply patch with low space on /system and /cache ----------------------
 
 $ADB push $DATA_DIR/old.file $WORK_DIR
-$ADB push $DATA_DIR/patch.xdelta3 $WORK_DIR
 $ADB push $DATA_DIR/patch.bsdiff $WORK_DIR
 
 free_kb=$(free_space $WORK_FS)
@@ -216,7 +189,7 @@
 run_command mkdir /cache/subdir
 run_command 'echo > /cache/subdir/a.file'
 run_command 'echo > /cache/a.file'
-run_command mkdir -p /cache/recovery/otatest
+run_command mkdir /cache/recovery /cache/recovery/otatest
 run_command 'echo > /cache/recovery/otatest/b.file'
 run_command "echo > $CACHE_TEMP_SOURCE"
 free_kb=$(free_space cache)
@@ -268,8 +241,8 @@
 # put some junk in the old file
 run_command dd if=/dev/urandom of=$WORK_DIR/old.file count=100 bs=1024 || fail
 
-testname "apply xdelta3 patch from cache (corrupted source) with low space"
-run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.xdelta3 || fail
+testname "apply bsdiff patch from cache (corrupted source) with low space"
+run_command $WORK_DIR/applypatch $WORK_DIR/old.file $NEW_SHA1 $NEW_SIZE $BAD1_SHA1:$WORK_DIR/foo $OLD_SHA1:$WORK_DIR/patch.bsdiff || fail
 $ADB pull $WORK_DIR/old.file $tmpdir/patched
 diff -q $DATA_DIR/new.file $tmpdir/patched || fail
 
diff --git a/tools/applypatch/bsdiff.c b/tools/applypatch/bsdiff.c
index f502a6b..a2851f9 100644
--- a/tools/applypatch/bsdiff.c
+++ b/tools/applypatch/bsdiff.c
@@ -1,20 +1,17 @@
 /*
  * Copyright (C) 2008 The Android Open Source Project
  *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
+ * 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
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ *      http://www.apache.org/licenses/LICENSE-2.0
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
+ * 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 file is a nearly line-for-line copy of bspatch.c from the
diff --git a/tools/applypatch/testdata/patch.xdelta3 b/tools/applypatch/testdata/patch.xdelta3
deleted file mode 100644
index 2af3ede..0000000
--- a/tools/applypatch/testdata/patch.xdelta3
+++ /dev/null
Binary files differ
diff --git a/tools/applypatch/xdelta3.c b/tools/applypatch/xdelta3.c
deleted file mode 100644
index c9a0f73..0000000
--- a/tools/applypatch/xdelta3.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/*
- * Copyright (C) 2008 The Android Open Source Project
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
- * 02110-1301, USA.
- */
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-
-#include "xdelta3.h"
-#include "mincrypt/sha.h"
-
-int ApplyXDelta3Patch(const unsigned char* old_data, ssize_t old_size,
-                      const char* patch_filename,
-                      FILE* output, SHA_CTX* ctx) {
-#define WINDOW_SIZE 32768
-
-  int ret;
-  xd3_stream stream;
-  xd3_config config;
-
-  xd3_init_config(&config, 0);
-  config.winsize = WINDOW_SIZE;
-  ret = xd3_config_stream(&stream, &config);
-  if (ret != 0) {
-    fprintf(stderr, "xd3_config_stream error: %s\n", xd3_strerror(ret));
-    return 1;
-  }
-
-  // In xdelta3 terms, the "input" is the patch file: it contains a
-  // sequence of instruction codes and data that will be executed to
-  // produce the output file.  The "source" is the original data file;
-  // it is a blob of data to which instructions in the input may refer
-  // (eg, an instruction may say "copy such-and-such range of bytes
-  // from the source to the output").
-
-  // For simplicity, we provide the entire source to xdelta as a
-  // single block.  This means it should never have to ask us to load
-  // blocks of the source file.
-  xd3_source source;
-  source.name = "old name";
-  source.size = old_size;
-  source.ioh = NULL;
-  source.blksize = old_size;
-  source.curblkno = 0;
-  source.curblk = old_data;
-  source.onblk = old_size;
-
-  ret = xd3_set_source(&stream, &source);
-  if (ret != 0) {
-    fprintf(stderr, "xd3_set_source error: %s\n", xd3_strerror(ret));
-    return 1;
-  }
-
-  unsigned char buffer[WINDOW_SIZE];
-  FILE* input = fopen(patch_filename, "rb");
-  if (input == NULL) {
-    fprintf(stderr, "failed to open patch file %s: %d (%s)\n",
-            patch_filename, errno, strerror(errno));
-    return 1;
-  }
-
-  size_t bytes_read;
-
-  do {
-    bytes_read = fread(buffer, 1, WINDOW_SIZE, input);
-    if (feof(input)) {
-      xd3_set_flags(&stream, XD3_FLUSH);
-    }
-    xd3_avail_input(&stream, buffer, bytes_read);
- process:
-    ret = xd3_decode_input(&stream);
-    switch (ret) {
-      case XD3_INPUT:
-        continue;
-      case XD3_OUTPUT:
-        SHA_update(ctx, stream.next_out, stream.avail_out);
-        if (fwrite(stream.next_out, 1, stream.avail_out, output) !=
-            stream.avail_out) {
-          fprintf(stderr, "short write of output file: %d (%s)\n",
-                  errno, strerror(errno));
-          return 1;
-        }
-        xd3_consume_output(&stream);
-        goto process;
-      case XD3_GETSRCBLK:
-        // We provided the entire source file already; it should never
-        // have to ask us for a block.
-        fprintf(stderr, "xd3_decode_input: unexpected GETSRCBLK\n");
-        return 1;
-      case XD3_GOTHEADER:
-      case XD3_WINSTART:
-      case XD3_WINFINISH:
-        // These are informational events we don't care about.
-        goto process;
-      default:
-        fprintf(stderr, "xd3_decode_input: unknown error %s (%s)\n",
-                xd3_strerror(ret), stream.msg);
-        return 1;
-    }
-  } while (!feof(input));
-
-  fclose(input);
-  return 0;
-
-#undef WINDOW_SIZE
-}
diff --git a/tools/droiddoc/templates/assets/android-developer-docs.css b/tools/droiddoc/templates/assets/android-developer-docs.css
index cfbcc75..44b5a4d 100644
--- a/tools/droiddoc/templates/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates/assets/android-developer-docs.css
@@ -207,7 +207,7 @@
 }
 	
 #jd-header {
-  background-color: #E9E9E9;
+  background-color: #E2E2E2;
   padding: 7px 20px;
 }
 
@@ -253,6 +253,86 @@
   position:relative;
 }
 
+/* summary tables for reference pages */
+.jd-sumtable {
+margin: .5em 1em 1em 1em;
+width:99%;
+font-size:.9em;
+}
+
+.jd-sumtable a {
+  text-decoration:none;
+}
+
+.jd-sumtable a:hover {
+  text-decoration:underline;
+}
+
+/* a div inside a sumtable th holding "Expand All" */
+.expandall {
+float:right;
+font-weight:normal;
+}
+
+/* adjustments for in/direct subclasses tables */
+.jd-sumtable-subclasses {
+  margin: 1em 0 0 0;
+  max-width:968px;
+}
+
+/* extra space between end of method name and open-paren */
+.sympad {
+  margin-right: 2px;
+}
+
+/* right alignment for the return type in sumtable */
+.jd-sumtable .jd-typecol {
+  text-align:right;
+}
+
+/* adjustments for the expando table-in-table */
+.jd-sumtable-expando {
+  margin:.5em 0;
+  padding:0;
+}
+
+/* a div that holds a short description */
+.jd-descrdiv {
+  width:100%; 
+  padding:3px 1em 0 1em;
+  margin:0;
+  border:0;
+}
+
+/* page-top-right container for reference pages (holds
+links to summary tables) */
+#api-info-block {
+  font-size:.8em;
+  margin:0;
+  padding:6px;
+  font-weight:normal;
+  float:right;
+  text-align:right;
+  color:#999;
+  max-width:70%;
+}
+
+/* applies to a div containing links to summary tables */
+.sum-details-links {
+  margin:0 .5em;
+  padding:0;
+  font-weight:normal;
+}
+
+.sum-details-links a {
+  text-decoration:none;
+}
+
+.sum-details-links a:hover {
+  text-decoration:underline;
+}
+
+
 /* inheritance table */
 .jd-inheritance-table {
   border-spacing:0;
@@ -295,7 +375,7 @@
   color:#111;
   border-top:2px solid #ccc;
   padding: .5em 0 0;
-  margin: 1.75em 0 1em 0;
+  margin: 1.5em 0 1em 0;
   max-width:968px;
 }
 
@@ -334,7 +414,12 @@
 .nolist {
   list-style:none;
   padding:0;
-  margin:0 0 1em 1em;
+  margin:0 0 0 1em;
+}
+
+.nolist li {
+  padding:0;
+  margin:0;
 }
 
 h4 .normal {
@@ -348,18 +433,57 @@
   margin:0 0 1em;
 }
 
-.jd-tagdata {
-  margin:.6em 0;
+/* API reference: a container for the
+.tagdata blocks that make up the detailed
+description */
+.jd-details-descr {
+  padding:0;
+  margin:.5em .25em;
 }
 
-.jd-tagdata ul {
+/* API reference: a block containing 
+a detailed description, a params table,
+seealso list, etc */
+.jd-tagdata {
+  margin:.5em 1em;
+}
+
+/* API reference: adjustments to
+the detailed description block */
+.jd-tagdescr {
+  margin:.25em 0 .75em 0;
+  line-height:1em;
+}
+
+.jd-tagdescr p {
+  margin:.5em 0;
+  padding:0;
+
+}
+
+.jd-tagdescr ol,
+.jd-tagdescr ul {
+  margin:0 2.5em;
   padding:0;
 }
 
+.jd-tagdescr table,
+.jd-tagdescr img {
+  margin:.25em 1em;
+}
+
+.jd-tagdescr li {
+margin:0 0 .25em 0;
+padding:0;
+}
+
+/* API reference: heading marking
+the details section for constants,
+attrs, methods, etc. */
 h4.jd-details-title {
   font-size:1.15em;
-  background-color: #d6d6d6;
-  margin:0 0 .6em;
+  background-color: #E2E2E2;
+  margin:1.5em 0 .6em;
   padding:3px;
 }
 
@@ -367,8 +491,11 @@
   margin:0;
 }
 
-.jd-details-descr {
-  padding:3px;
+/* API reference: heading for "Parameters", "See Also", etc.,
+in details sections */
+h5.jd-tagtitle {
+  margin:0 0 .25em 0;
+  font-size:1em;
 }
 
 .jd-tagtable {
@@ -398,13 +525,13 @@
 }
 
 div.special {
-  padding: 15px 20px 3px;
+  padding: .5em 1em 1em 1em;
   margin: 0 0 1em;
   background-color: #ddf0f2;
 }
 
 div.special p {
-  margin: .25em 0;
+  margin: .5em 0 0 0;
 }
 
 div.special ol {
@@ -529,6 +656,7 @@
   margin-top:0px;
   width:295;
   float:right;
+  font-size:.9em;
 }
 
 #qv ol {
@@ -725,7 +853,7 @@
 }
 
 tr.alt-color {
-  background-color: #e6e6e6;
+  background-color: #f6f6f6;
 }
 
 /* expando trigger */
diff --git a/tools/droiddoc/templates/class.cs b/tools/droiddoc/templates/class.cs
index 1fd4369..005ed6a 100644
--- a/tools/droiddoc/templates/class.cs
+++ b/tools/droiddoc/templates/class.cs
@@ -23,6 +23,84 @@
 
 <div class="g-unit" id="doc-content">
 
+<div id="api-info-block">
+
+<?cs # are there inherited members ?>
+<?cs each:cl=class.inherited ?>
+  <?cs if:subcount(cl.methods) ?>
+   <?cs set:inhmethods = #1 ?>
+  <?cs /if ?>
+  <?cs if:subcount(cl.constants) ?>
+   <?cs set:inhconstants = #1 ?>
+  <?cs /if ?>
+  <?cs if:subcount(cl.fields) ?>
+   <?cs set:inhfields = #1 ?>
+  <?cs /if ?>
+  <?cs if:subcount(cl.attrs) ?>
+   <?cs set:inhattrs = #1 ?>
+  <?cs /if ?>
+<?cs /each ?>
+
+<div class="sum-details-links">
+Summary:
+<?cs if:subcount(class.inners) ?>
+  <a href="#nestedclasses">Nested Classes</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.attrs) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#lattrs">XML Attrs</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:inhattrs ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#inhattrs">Inherited XML Attrs</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.enumConstants) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#enumconstants">Enums</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.constants) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#constants">Constants</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:inhconstants ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#inhconstants">Inherited Constants</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.fields) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#lfields">Fields</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:inhfields ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#inhfields">Inherited Fields</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.ctors.public) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#pubctors">Ctors</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.ctors.protected) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#proctors">Protected Ctors</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.methods.public) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#pubmethods">Methods</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:subcount(class.methods.protected) ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#promethods">Protected Methods</a>
+  <?cs set:linkcount = #1 ?>
+<?cs /if ?>
+<?cs if:inhmethods ?>
+  <?cs if:linkcount ?>&#124; <?cs /if ?><a href="#inhmethods">Inherited Methods</a>
+<?cs /if ?>
+</nobr>
+<?cs if:inhattrs || inhconstants || inhfields || inhmethods || subcount(class.subclasses.direct) || subcount(class.subclasses.indirect) ?>
+&#124; [<a href="">Expand All</a>]
+<?cs /if ?>
+</div>
+</div>
+
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- ======== START OF CLASS DATA ======== -->
 
@@ -58,7 +136,7 @@
     <tr>
         <?cs loop:i = 1, (subcount(class.inheritance)-colspan), 1 ?>
             <td class="jd-inheritance-space">&nbsp;<?cs if:(subcount(class.inheritance)-colspan) == i ?>&nbsp;&nbsp;&#x21b3;<?cs /if ?></td>
-        <?cs /loop ?>
+        <?cs /loop ?> 	
         <td colspan="<?cs var:colspan ?>" class="jd-inheritance-class-cell"><?cs
             if:colspan == 1
                 ?><?cs call:class_name(class.qualifiedType) ?><?cs 
@@ -70,6 +148,21 @@
 <?cs /each ?>
 </table>
 
+<?cs # this next line must be exactly like this to be parsed by eclipse ?>
+<!-- ======== NESTED CLASS SUMMARY ======== -->
+<?cs if:subcount(class.subclasses.direct) ?>
+<table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="12" style="border:none;margin:0;padding:0;">
+<?cs call:expando_trigger("subclasses-direct", "closed") ?>Known Direct Subclasses
+<?cs call:expandable_class_list("subclasses-direct", class.subclasses.direct, "list") ?>
+</td></tr></table>
+<?cs /if ?>
+
+<?cs if:subcount(class.subclasses.indirect) ?>
+<table class="jd-sumtable jd-sumtable-subclasses"><tr><td colspan="12" style="border:none;margin:0;padding:0;">
+<?cs call:expando_trigger("subclasses-indirect", "closed") ?>Known Indirect Subclasses
+<?cs call:expandable_class_list("subclasses-indirect", class.subclasses.indirect, "list") ?>
+</td></tr></table>
+<?cs /if ?>
 
 <div class="jd-descr">
 <?cs call:deprecated_warning(class) ?>
@@ -78,33 +171,15 @@
 <p><?cs call:tag_list(class.descr) ?></p>
 <?cs /if ?>
 
-<?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- ======== NESTED CLASS SUMMARY ======== -->
-<?cs if:subcount(class.inners) ?>
-<h4><?cs call:expando_trigger("nested-classes", "opened") ?>Nested Classes</h4>
-<?cs call:expandable_class_list("nested-classes", class.inners, "summary") ?>
-<?cs /if ?>
-
-<?cs if:subcount(class.subclasses.direct) ?>
-<h4><?cs call:expando_trigger("subclasses-direct", "closed") ?>Known Direct Subclasses</h4>
-<?cs call:expandable_class_list("subclasses-direct", class.subclasses.direct, "list") ?>
-<?cs /if ?>
-
-<?cs if:subcount(class.subclasses.indirect) ?>
-<h4><?cs call:expando_trigger("subclasses-indirect", "closed") ?>Known Indirect Subclasses</h4>
-<?cs call:expandable_class_list("subclasses-indirect", class.subclasses.indirect, "list") ?>
-<?cs /if ?>
-
 <?cs call:see_also_tags(class.seeAlso) ?>
 
 </div><!-- jd-descr -->
 
 
-<?cs # summar macros ?>
+<?cs # summary macros ?>
 
 <?cs def:write_method_summary(methods) ?>
 <?cs set:count = #1 ?>
-<table class="jd-linktable">
 <?cs each:method = methods ?>
     <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
         <td class="jd-typecol"><nobr>
@@ -115,71 +190,80 @@
             <?cs call:type_link(method.generic) ?>
             <?cs call:type_link(method.returnType) ?></nobr>
         </td>
-        <td class="jd-linkcol" width="100%"><a href="<?cs var:toroot ?><?cs var:method.href ?>"><strong><?cs var:method.name ?></strong></a>(<?cs call:parameter_list(method.params) ?>)</td>
-    </tr>
-  <?cs if:subcount(method.shortDescr) || subcount(method.deprecated) ?>
-    <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
-          <td class="jd-commentrow"></td>
-          <td class="jd-commentrow"><?cs call:short_descr(method) ?></td>
-    </tr>
+        <td class="jd-linkcol" width="100%"><nobr>
+        <span class="sympad"><a href="<?cs var:toroot ?><?cs var:method.href ?>">
+        <?cs var:method.name ?></a></span>(<?cs call:parameter_list(method.params) ?>)</nobr>
+        <?cs if:subcount(method.shortDescr) || subcount(method.deprecated) ?>
+        <div class="jd-descrdiv"><?cs call:short_descr(method) ?></div>
   <?cs /if ?>
+  </td></tr>
 <?cs set:count = count + #1 ?>
 <?cs /each ?>
-</table>
 <?cs /def ?>
 
 <?cs def:write_field_summary(fields) ?>
 <?cs set:count = #1 ?>
-<table class="jd-linktable">
     <?cs each:field=fields ?>
       <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
-          <td class="jd-descrcol"><?cs var:field.scope ?>&nbsp;</td>
-          <td class="jd-descrcol"><?cs var:field.static ?>&nbsp;</td>
-          <td class="jd-descrcol"><?cs var:field.final ?>&nbsp;</td>
-          <td class="jd-descrcol"><?cs call:type_link(field.type) ?>&nbsp;</td>
-          <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:field.href ?>"><?cs var:field.name ?></a>&nbsp;</td>
-          <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?>&nbsp;</td>
+          <td class="jd-typecol"><nobr>
+          <?cs var:field.scope ?>
+          <?cs var:field.static ?>
+          <?cs var:field.final ?>
+          <?cs call:type_link(field.type) ?></nobr></td>
+          <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:field.href ?>"><?cs var:field.name ?></a></td>
+          <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?></td>
       </tr>
       <?cs set:count = count + #1 ?>
     <?cs /each ?>
-</table>
 <?cs /def ?>
 
 <?cs def:write_constant_summary(fields) ?>
 <?cs set:count = #1 ?>
-<table class="jd-linktable">
-
     <?cs each:field=fields ?>
     <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
-        <td class="jd-descrcol"><?cs call:type_link(field.type) ?>&nbsp;</td>
-        <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:field.href ?>"><?cs var:field.name ?></a>&nbsp;</td>
-        <td class="jd-descrcol"><?cs call:short_descr(field) ?>&nbsp;</td>
+        <td class="jd-typecol"><?cs call:type_link(field.type) ?></td>
+        <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:field.href ?>"><?cs var:field.name ?></a></td>
+        <td class="jd-descrcol" width="100%"><?cs call:short_descr(field) ?></td>
     </tr>
     <?cs set:count = count + #1 ?>
     <?cs /each ?>
-</table>
 <?cs /def ?>
 
 <?cs def:write_attr_summary(attrs) ?>
 <?cs set:count = #1 ?>
-<table class="jd-linktable">
     <tr>
-        <th>Attribute name</th>
-        <th>Related methods</th>
-        <th>&nbsp;</th>
+        <td><nobr><em>Attribute Name</em></nobr></td>
+        <td><nobr><em>Related Method</em></nobr></td>
+        <td><nobr><em>Description</em></nobr></td>
     </tr>
     <?cs each:attr=attrs ?>
     <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
         <td class="jd-linkcol"><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></td>
-        <td class="jd-linkcol"><?cs each:m=attr.methods 
-            ?><a href="<?cs var:toroot ?><?cs var:m.href ?>"><?cs var:m.name ?></a><br/>
-            <?cs /each ?>&nbsp;
+        <td class="jd-linkcol"><?cs each:m=attr.methods ?>
+            <a href="<?cs var:toroot ?><?cs var:m.href ?>"><?cs var:m.name ?></a>
+            <?cs /each ?>
         </td>
         <td class="jd-descrcol" width="100%"><?cs call:short_descr(attr) ?>&nbsp;</td>
     </tr>
     <?cs set:count = count + #1 ?>
     <?cs /each ?>
-</table>
+<?cs /def ?>
+
+<?cs def:write_inners_summary(classes) ?>
+<?cs set:count = #1 ?>
+  <?cs each:cl=class.inners ?>
+    <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
+      <td class="jd-typecol"><nobr>
+        <?cs var:class.scope ?>
+        <?cs var:class.static ?> 
+        <?cs var:class.final ?> 
+        <?cs var:class.abstract ?>
+        <?cs var:class.kind ?></nobr></td>
+      <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
+      <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?>&nbsp;</td>
+    </tr>
+    <?cs set:count = count + #1 ?>
+    <?cs /each ?>
 <?cs /def ?>
 
 <?cs # end macros ?>
@@ -187,39 +271,50 @@
 <div class="jd-descr">
 <h2>Summary</h2>
 
+<?cs if:subcount(class.inners) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
-<!-- =========== FIELD SUMMARY =========== -->
+<!-- ======== NESTED CLASS SUMMARY ======== -->
+<table id="nestedclasses" class="jd-sumtable"><tr><th colspan="12">Nested Classes</th></tr>
+<?cs call:write_inners_summary(class.inners) ?>
+<?cs /if ?>
+
+<?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <?cs if:subcount(class.attrs) ?>
-<h3>XML Attributes</h3>
+<!-- =========== FIELD SUMMARY =========== -->
+<table id="lattrs" class="jd-sumtable"><tr><th colspan="12">XML Attributes</th></tr>
 <?cs call:write_attr_summary(class.attrs) ?>
 <?cs /if ?>
 
+<?cs # if there are inherited attrs, write the table ?>
+<?cs if:inhattrs ?>
+<table id="inhattrs" class="jd-sumtable"><tr><th>
+  <div class="expandall">[<a href="">Expand All</a>]</div>
+  <div style="clear:left;">Inherited XML Attributes</div></th></tr>
 <?cs each:cl=class.inherited ?>
 <?cs if:subcount(cl.attrs) ?>
-<h4><?cs call:expando_trigger("inherited-attrs-"+cl.qualified, "closed") ?>XML Attributes inherited
-    from <?cs var:cl.kind ?>
-    <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
-</h4>
+<tr><td colspan="12">
+<?cs call:expando_trigger("inherited-attrs-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
+<a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
 <div id="inherited-attrs-<?cs var:cl.qualified ?>">
   <div id="inherited-attrs-<?cs var:cl.qualified ?>-list"
-          class="jd-inheritedlinks">
+        class="jd-inheritedlinks">
   </div>
-  <div id="inherited-attrs-<?cs var:cl.qualified ?>-summary"
-      style="display: none;">
-  <?cs call:write_attr_summary(cl.attrs) ?>
+  <div id="inherited-attrs-<?cs var:cl.qualified ?>-summary" style="display: none;">
+    <table class="jd-sumtable-expando">
+    <?cs call:write_attr_summary(cl.attrs) ?></table>
   </div>
 </div>
+</td></tr>
 <?cs /if ?>
 <?cs /each ?>
-
-
+</table>
+<?cs /if ?>
 
 <?cs if:subcount(class.enumConstants) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- =========== ENUM CONSTANT SUMMARY =========== -->
-<h3>Enum Values</h3>
+<table id="enumconstants" class="jd-sumtable"><tr><th colspan="12">Enum Values</th></tr>
 <?cs set:count = #1 ?>
-<table class="jd-linktable">
     <?cs each:field=class.enumConstants ?>
     <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
         <td class="jd-descrcol"><?cs call:type_link(field.type) ?>&nbsp;</td>
@@ -228,109 +323,129 @@
     </tr>
     <?cs set:count = count + #1 ?>
     <?cs /each ?>
-</table>
 <?cs /if ?>
 
 <?cs if:subcount(class.constants) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- =========== FIELD SUMMARY =========== -->
-<h3>Constants</h3>
+<table id="constants" class="jd-sumtable"><tr><th colspan="12">Constants</th></tr>
 <?cs call:write_constant_summary(class.constants) ?>
+</table>
 <?cs /if ?>
 
+<?cs # if there are inherited constants, write the table ?>
+<?cs if:inhconstants ?>
+<table id="inhconstants" class="jd-sumtable"><tr><th>
+  <div class="expandall">[<a href="">Expand All</a>]</div>
+  <div style="clear:left;">Inherited Constants</div></th></tr>
 <?cs each:cl=class.inherited ?>
 <?cs if:subcount(cl.constants) ?>
-<h4><?cs call:expando_trigger("inherited-constants-"+cl.qualified, "closed") ?>Constants inherited
-    from <?cs var:cl.kind ?>
-    <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
-</h4>
+<tr><td colspan="12">
+<?cs call:expando_trigger("inherited-constants-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
+<a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
 <div id="inherited-constants-<?cs var:cl.qualified ?>">
-<div id="inherited-constants-<?cs var:cl.qualified ?>-list"
+  <div id="inherited-constants-<?cs var:cl.qualified ?>-list"
         class="jd-inheritedlinks">
-
+  </div>
+  <div id="inherited-constants-<?cs var:cl.qualified ?>-summary" style="display: none;">
+    <table class="jd-sumtable-expando">
+    <?cs call:write_constant_summary(cl.constants) ?></table>
+  </div>
 </div>
-<div id="inherited-constants-<?cs var:cl.qualified ?>-summary"
-    style="display: none;">
-<?cs call:write_constant_summary(cl.constants) ?>
-</div>
-</div>
+</td></tr>
 <?cs /if ?>
 <?cs /each ?>
-
+</table>
+<?cs /if ?>
 
 <?cs if:subcount(class.fields) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- =========== FIELD SUMMARY =========== -->
-<h3>Fields</h3>
+<table id="lfields" class="jd-sumtable"><tr><th colspan="12">Fields</th></tr>
 <?cs call:write_field_summary(class.fields) ?>
+</table>
 <?cs /if ?>
 
+<?cs # if there are inherited fields, write the table ?>
+<?cs if:inhfields ?>
+<table id="inhfields" class="jd-sumtable"><tr><th>
+  <div class="expandall">[<a href="">Expand All</a>]</div>
+  <div style="clear:left;">Inherited Fields</div></th></tr>
 <?cs each:cl=class.inherited ?>
 <?cs if:subcount(cl.fields) ?>
-<h4><?cs call:expando_trigger("inherited-fields-"+cl.qualified, "closed") ?>Fields inherited
-    from <?cs var:cl.kind ?>
-    <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
-</h4>
+<tr><td colspan="12">
+<?cs call:expando_trigger("inherited-fields-"+cl.qualified, "closed") ?>From <?cs var:cl.kind ?>
+<a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
 <div id="inherited-fields-<?cs var:cl.qualified ?>">
-<div id="inherited-fields-<?cs var:cl.qualified ?>-list"
+  <div id="inherited-fields-<?cs var:cl.qualified ?>-list"
         class="jd-inheritedlinks">
-
+  </div>
+  <div id="inherited-fields-<?cs var:cl.qualified ?>-summary" style="display: none;">
+    <table class="jd-sumtable-expando">
+    <?cs call:write_field_summary(cl.fields) ?></table>
+  </div>
 </div>
-<div id="inherited-fields-<?cs var:cl.qualified ?>-summary"
-    style="display: none;">
-<?cs call:write_field_summary(cl.fields) ?>
-</div>
-</div>
+</td></tr>
 <?cs /if ?>
 <?cs /each ?>
-
+</table>
+<?cs /if ?>
 
 <?cs if:subcount(class.ctors.public) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
-<h3>Public Constructors</h3>
+<table id="pubctors" class="jd-sumtable"><tr><th colspan="12">Public Constructors</th></tr>
 <?cs call:write_method_summary(class.ctors.public) ?>
+</table>
 <?cs /if ?>
 
 <?cs if:subcount(class.ctors.protected) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
-<h3>Protected Constructors</h3>
+<table id="proctors" class="jd-sumtable"><tr><th colspan="12">Protected Constructors</th></tr>
 <?cs call:write_method_summary(class.ctors.protected) ?>
+</table>
 <?cs /if ?>
 
 <?cs if:subcount(class.methods.public) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- ========== METHOD SUMMARY =========== -->
-<h3>Public Methods</h3>
+<table id="pubmethods" class="jd-sumtable"><tr><th colspan="12">Public Methods</th></tr>
 <?cs call:write_method_summary(class.methods.public) ?>
+</table>
 <?cs /if ?>
 
 <?cs if:subcount(class.methods.protected) ?>
 <?cs # this next line must be exactly like this to be parsed by eclipse ?>
 <!-- ========== METHOD SUMMARY =========== -->
-<h3>Protected Methods</h3>
+<table id="promethods" class="jd-sumtable"><tr><th colspan="12">Protected Methods</th></tr>
 <?cs call:write_method_summary(class.methods.protected) ?>
+</table>
 <?cs /if ?>
 
+<?cs # if there are inherited methods, write the table ?>
+<?cs if:inhmethods ?>
+<table id="inhmethods" class="jd-sumtable"><tr><th>
+  <div class="expandall">[<a href="">Expand All</a>]</div>
+  <div style="clear:left;">Inherited Methods</div></th></tr>
 <?cs each:cl=class.inherited ?>
 <?cs if:subcount(cl.methods) ?>
-<h4><?cs call:expando_trigger("inherited-methods-"+cl.qualified, "closed") ?>Methods inherited
-    from <?cs var:cl.kind ?>
-    <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
-</h4>
+<tr><td colspan="12"><?cs call:expando_trigger("inherited-methods-"+cl.qualified, "closed") ?>
+From <?cs var:cl.kind ?> <a href="<?cs var:toroot ?><?cs var:cl.link ?>"><?cs var:cl.qualified ?></a>
 <div id="inherited-methods-<?cs var:cl.qualified ?>">
-<div id="inherited-methods-<?cs var:cl.qualified ?>-list"
+  <div id="inherited-methods-<?cs var:cl.qualified ?>-list"
         class="jd-inheritedlinks">
-
+  </div>
+  <div id="inherited-methods-<?cs var:cl.qualified ?>-summary" style="display: none;">
+    <table class="jd-sumtable-expando">
+    <?cs call:write_method_summary(cl.methods) ?></table>
+  </div>
 </div>
-<div id="inherited-methods-<?cs var:cl.qualified ?>-summary"
-    style="display: none;">
-<?cs call:write_method_summary(cl.methods) ?>
-</div>
-</div>
+</td></tr>
 <?cs /if ?>
 <?cs /each ?>
+</table>
+<?cs /if ?>
 
 </div><!-- jd-descr (summary) -->
 
@@ -381,7 +496,8 @@
         <?cs var:method.synchronized ?> 
         <?cs call:type_link(method.returnType) ?>
       </span>
-        <?cs var:method.name ?>(<?cs call:parameter_list(method.params) ?>)
+      <span class="sympad"><?cs var:method.name ?></span>
+      <span class="normal">(<?cs call:parameter_list(method.params) ?>)</span>
     </h4>
     <div class="jd-details-descr"><?cs call:description(method) ?></div>
 </div>
diff --git a/tools/droiddoc/templates/classes.cs b/tools/droiddoc/templates/classes.cs
index 44aefbd..f8494e5 100644
--- a/tools/droiddoc/templates/classes.cs
+++ b/tools/droiddoc/templates/classes.cs
@@ -18,10 +18,10 @@
 <?cs each:letter=docs.classes ?>
 <?cs set:count = #1 ?>
 <h2 id="letter_<?cs name:letter ?>"><?cs name:letter ?></h2>
-<table class="jd-linktable jd-lettertable">
+<table class="jd-sumtable">
     <?cs set:cur_row = #0 ?>
     <?cs each:cl = letter ?>
-        <tr class="jd-letterentries <?cs if:count % #2 ?>alt-color<?cs /if ?>" >
+        <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
             <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
             <td class="jd-descrcol" width="100%"><?cs call:short_descr(cl) ?>&nbsp;</td>
         </tr>
diff --git a/tools/droiddoc/templates/macros.cs b/tools/droiddoc/templates/macros.cs
index 1325496..8f5fa8e 100644
--- a/tools/droiddoc/templates/macros.cs
+++ b/tools/droiddoc/templates/macros.cs
@@ -103,7 +103,7 @@
 <?cs def:see_also_tags(also) ?>
 <?cs if:subcount(also) ?>
 <div class="jd-tagdata">
-    <h4 class="jd-tagtitle">See Also</h4>
+    <h5 class="jd-tagtitle">See Also</h5>
     <ul class="nolist">
     <?cs each:tag=also
     ?><li><?cs
@@ -114,8 +114,7 @@
         else ?>[ERROR: Unknown @see kind]<?cs
         /if ?></li>
     <?cs /each ?>
-    </table>
-    <ul>
+    </ul>
 </div>
 <?cs /if ?>
 <?cs /def ?>
@@ -127,11 +126,12 @@
 <?cs def:description(obj) ?>
 
 <?cs call:deprecated_warning(obj) ?>
-<?cs call:tag_list(obj.descr) ?>
+<div class="jd-tagdata jd-tagdescr"><p><?cs call:tag_list(obj.descr) ?></p></div>
+
 
 <?cs if:subcount(obj.attrRefs) ?>
 <div class="jd-tagdata">
-    <h4 class="jd-tagtitle">Related XML Attributes</h4>
+    <h5 class="jd-tagtitle">Related XML Attributes</h5>
     <ul class="nolist">
     <?cs each:attr=obj.attrRefs ?>
         <li><a href="<?cs var:toroot ?><?cs var:attr.href ?>"><?cs var:attr.name ?></a></li>
@@ -142,7 +142,7 @@
 
 <?cs if:subcount(obj.paramTags) ?>
 <div class="jd-tagdata">
-    <h4 class="jd-tagtitle">Parameters</h4>
+    <h5 class="jd-tagtitle">Parameters</h5>
     <table class="jd-tagtable">
     <?cs each:tag=obj.paramTags
     ?><tr>
@@ -158,14 +158,14 @@
 
 <?cs if:subcount(obj.returns) ?>
 <div class="jd-tagdata">
-    <h4 class="jd-tagtitle">Returns</h4>
+    <h5 class="jd-tagtitle">Returns</h5>
     <ul class="nolist"><li><?cs call:tag_list(obj.returns) ?></li></ul>
 </div>
 <?cs /if ?>
 
 <?cs if:subcount(obj.throws) ?>
 <div class="jd-tagdata">
-    <h4 class="jd-tagtitle">Throws</h4>
+    <h5 class="jd-tagtitle">Throws</h5>
     <table class="jd-tagtable">
     <?cs each:tag=obj.throws
     ?>  <tr>
@@ -185,7 +185,7 @@
 <?cs # A table of links to classes with descriptions, as in a package file or the nested classes ?>
 <?cs def:class_link_table(classes) ?>
 <?cs set:count = #1 ?>
-<table class="jd-linktable"><?cs
+<table class="jd-sumtable-expando"><?cs
     each:cl=classes ?>
       <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
             <td class="jd-linkcol"><?cs call:type_link(cl.type) ?></td>
diff --git a/tools/droiddoc/templates/package.cs b/tools/droiddoc/templates/package.cs
index 65f0278..becf482 100644
--- a/tools/droiddoc/templates/package.cs
+++ b/tools/droiddoc/templates/package.cs
@@ -29,7 +29,9 @@
 <?cs def:class_table(label, classes) ?>
   <?cs if:subcount(classes) ?>
     <h3><?cs var:label ?></h3>
+    <div class="jd-sumtable">
     <?cs call:class_link_table(classes) ?>
+    </div>
   <?cs /if ?>
 <?cs /def ?>
 
diff --git a/tools/droiddoc/templates/packages.cs b/tools/droiddoc/templates/packages.cs
index 14f7246..3ef85b8 100644
--- a/tools/droiddoc/templates/packages.cs
+++ b/tools/droiddoc/templates/packages.cs
@@ -17,9 +17,9 @@
 </div>
 
 <?cs set:count = #1 ?>
-<table class="jd-linktable">
+<table class="jd-sumtable">
 <?cs each:pkg = docs.packages ?>
-    <tr class="jd-letterentries <?cs if:count % #2 ?>alt-color<?cs /if ?>" >
+    <tr <?cs if:count % #2 ?>class="alt-color"<?cs /if ?> >
         <td class="jd-linkcol"><?cs call:package_link(pkg) ?></td>
         <td class="jd-descrcol" width="100%"><?cs call:tag_list(pkg.shortDescr) ?>&nbsp;</td>
     </tr>