Merge "Update versions of the Eclipse prebuilt libraries"
diff --git a/core/Makefile b/core/Makefile
index a4497be..169fc02 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -408,6 +408,11 @@
 # -----------------------------------------------------------------
 # NOTICE files
 #
+# We are required to publish the licenses for all code under BSD, GPL and
+# Apache licenses (and possibly other more exotic ones as well). We err on the
+# side of caution, so the licenses for other third-party code are included here
+# too.
+#
 # This needs to be before the systemimage rules, because it adds to
 # ALL_DEFAULT_INSTALLED_MODULES, which those use to pick which files
 # go into the systemimage.
@@ -435,78 +440,9 @@
 # Then we could traverse that without quite as much bash drama.
 define combine-notice-files
 $(1) $(2): PRIVATE_MESSAGE := $(3)
-$(1) $(2) $(4)/hash-timestamp: PRIVATE_DIR := $(4)
-$(4)/hash-timestamp: $(5) $(BUILD_SYSTEM)/Makefile
-	@echo Finding NOTICE files: $$@
-	$$(hide) rm -rf $$@ $$(PRIVATE_DIR)/hash
-	$$(hide) mkdir -p $$(PRIVATE_DIR)/hash
-	$$(hide) for file in $$$$(find $$(PRIVATE_DIR)/src -type f); do \
-			hash=$$$$($(MD5SUM) $$$$file | sed -e "s/ .*//"); \
-			hashfile=$$(PRIVATE_DIR)/hash/$$$$hash; \
-			echo $$$$file >> $$$$hashfile; \
-		done
-	$$(hide) touch $$@
-$(1): $(4)/hash-timestamp
-	@echo Combining NOTICE files: $$@
-	$$(hide) mkdir -p $$(dir $$@)
-	$$(hide) echo $$(PRIVATE_MESSAGE) > $$@
-	$$(hide) find $$(PRIVATE_DIR)/hash -type f | xargs cat | sort | \
-		sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> $$@
-	$$(hide) echo >> $$@
-	$$(hide) echo >> $$@
-	$$(hide) echo >> $$@
-	$$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
-			echo "============================================================"\
-				>> $$@; \
-			echo "Notices for file(s):" >> $$@; \
-			cat $$$$hashfile | sort | \
-				sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1:" >> \
-				$$@; \
-			echo "------------------------------------------------------------"\
-				>> $$@; \
-			echo >> $$@; \
-			orig=$$$$(head -n 1 $$$$hashfile); \
-			cat $$$$orig >> $$@; \
-			echo >> $$@; \
-			echo >> $$@; \
-			echo >> $$@; \
-		done
-$(2): $(4)/hash-timestamp
-	@echo Combining NOTICE files: $$@
-	$$(hide) mkdir -p $$(dir $$@)
-	$$(hide) echo "<html><head>" > $$@
-	$$(hide) echo "<style type=\"text/css\">" >> $$@
-	$$(hide) echo "body { padding: 0; font-family: sans-serif; }" >> $$@
-	$$(hide) echo ".same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }" >> $$@
-	$$(hide) echo ".label { font-weight: bold; }" >> $$@
-	$$(hide) echo ".file-list { margin-left: 1em; font-color: blue; }" >> $$@
-	$$(hide) echo "</style>" >> $$@
-	$$(hide) echo "</head><body topmargin=\"0\" leftmargin=\"0\" rightmargin=\"0\" bottommargin=\"0\">" >> $$@
-	$$(hide) echo "<table cellpading=\"0\" cellspacing=\"0\" border=\"0\">" \
-		>> $$@
-	$$(hide) for hashfile in $$$$(find $$(PRIVATE_DIR)/hash -type f); do \
-			cat $$$$hashfile | sort | \
-				sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  <a name=\"\1\"></a>:" >> \
-				$$@; \
-			echo "<tr><td class=\"same-license\">" >> $$@; \
-			echo "<div class=\"label\">Notices for file(s):</div>" >> $$@; \
-			echo "<div class=\"file-list\">" >> $$@; \
-			cat $$$$hashfile | sort | \
-				sed -e "s:$$(PRIVATE_DIR)/src\(.*\)\.txt:  \1<br/>:" >> $$@; \
-			echo "</div><!-- file-list -->" >> $$@; \
-			echo >> $$@; \
-			orig=$$$$(head -n 1 $$$$hashfile); \
-			echo "<pre class=\"license-text\">" >> $$@; \
-			cat $$$$orig | sed -e "s/\&/\&amp;/g" | sed -e "s/</\&lt;/g" \
-					| sed -e "s/>/\&gt;/g" >> $$@; \
-			echo "</pre><!-- license-text -->" >> $$@; \
-			echo "</td></tr><!-- same-license -->" >> $$@; \
-			echo >> $$@; \
-			echo >> $$@; \
-			echo >> $$@; \
-		done
-	$$(hide) echo "</table>" >> $$@
-	$$(hide) echo "</body></html>" >> $$@
+$(1) $(2): PRIVATE_DIR := $(4)
+$(1) $(2): $(5) $(BUILD_SYSTEM)/Makefile build/tools/generate-notice-files.py
+	build/tools/generate-notice-files.py $(1) $(2) $$(PRIVATE_MESSAGE) $$(PRIVATE_DIR)/src
 notice_files: $(1) $(2)
 endef
 
@@ -626,7 +562,7 @@
 # Recovery image
 
 # If neither TARGET_NO_KERNEL nor TARGET_NO_RECOVERY are true
-ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID) $(BUILD_PDK)))
+ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID) $(TARGET_BUILD_PDK)))
 
 INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
 
@@ -746,7 +682,8 @@
     $(ALL_PREBUILT) \
     $(ALL_COPIED_HEADERS) \
     $(ALL_GENERATED_SOURCES) \
-    $(ALL_DEFAULT_INSTALLED_MODULES))
+    $(ALL_DEFAULT_INSTALLED_MODULES)\
+    $(ALL_PDK_FUSION_FILES))
 
 ifdef is_tests_build
 # We don't want to install tests modules to the system partition
@@ -864,6 +801,21 @@
 .PHONY: stnod
 stnod: systemtarball-nodeps
 
+#######
+## platform.zip: system in a zip file
+INSTALLED_PLATFROM_ZIP := $(PRODUCT_OUT)/platform.zip
+$(INSTALLED_PLATFROM_ZIP) : $(INTERNAL_SYSTEMIMAGE_FILES)
+	$(call pretty,"Platform zip package: $(INSTALLED_PLATFROM_ZIP)")
+	$(hide) rm -f $@
+	$(hide) cd $(dir $@) && zip -qry $(notdir $@) system
+
+.PHONY: platform
+platform: $(INSTALLED_PLATFROM_ZIP)
+
+# Dist the platform.zip
+ifneq (,$(filter platform, $(MAKECMDGOALS)))
+$(call dist-for-goals, platform, $(INSTALLED_PLATFROM_ZIP))
+endif
 
 #######
 ## boot tarball
@@ -1253,13 +1205,11 @@
 
 # Target needed by tests build
 .PHONY: tests-build-target
-tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \
-                    $(BUILT_USERDATAIMAGE_TARGET)
+tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE)
 
 ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
   $(call dist-for-goals, tests-build-target, \
-          $(BUILT_TESTS_ZIP_PACKAGE) \
-          $(BUILT_USERDATAIMAGE_TARGET))
+          $(BUILT_TESTS_ZIP_PACKAGE))
 endif
 
 .PHONY: tests
diff --git a/core/binary.mk b/core/binary.mk
index e488200..f1ffca1 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -123,6 +123,13 @@
 #######################################
 include $(BUILD_SYSTEM)/base_rules.mk
 #######################################
+my_compiler_dependencies :=
+ifeq ($(strip $(LOCAL_CLANG)),true)
+  LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS)
+  LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS)
+  LOCAL_C_INCLUDES += $(CLANG_CONFIG_EXTRA_C_INCLUDES)
+  my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
+endif
 
 ####################################################
 ## Add FDO flags if FDO is turned on and supported
@@ -142,16 +149,22 @@
 ###########################################################
 ## Define PRIVATE_ variables from global vars
 ###########################################################
+ifeq ($(strip $(LOCAL_CLANG)),true)
+my_target_global_cflags := $(TARGET_GLOBAL_CLANG_FLAGS)
+else
+my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
+endif
+
 ifdef LOCAL_NDK_VERSION
 my_target_project_includes :=
 my_target_c_inclues := $(my_ndk_stl_include_path) $(my_ndk_version_root)/usr/include
 # TODO: more reliable way to remove platform stuff.
-my_target_global_cflags := $(filter-out -include -I system/%, $(TARGET_GLOBAL_CFLAGS))
+my_target_global_cflags := $(filter-out -include -I system/%, $(my_target_global_cflags))
 my_target_global_cppflags := $(filter-out -include -I system/%, $(TARGET_GLOBAL_CPPFLAGS))
 else
 my_target_project_includes := $(TARGET_PROJECT_INCLUDES)
 my_target_c_inclues := $(TARGET_C_INCLUDES)
-my_target_global_cflags := $(TARGET_GLOBAL_CFLAGS)
+my_target_global_cflags := $(my_target_global_cflags)
 my_target_global_cppflags := $(TARGET_GLOBAL_CPPFLAGS)
 endif
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_PROJECT_INCLUDES := $(my_target_project_includes)
@@ -163,15 +176,23 @@
 ## Define PRIVATE_ variables used by multiple module types
 ###########################################################
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_DEFAULT_COMPILER_FLAGS := \
-	$(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
+    $(strip $(LOCAL_NO_DEFAULT_COMPILER_FLAGS))
 
 ifeq ($(strip $(LOCAL_CC)),)
-  LOCAL_CC := $($(my_prefix)CC)
+  ifeq ($(strip $(LOCAL_CLANG)),true)
+    LOCAL_CC := $(CLANG)
+  else
+    LOCAL_CC := $($(my_prefix)CC)
+  endif
 endif
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CC := $(LOCAL_CC)
 
 ifeq ($(strip $(LOCAL_CXX)),)
-  LOCAL_CXX := $($(my_prefix)CXX)
+  ifeq ($(strip $(LOCAL_CLANG)),true)
+    LOCAL_CXX := $(CLANG_CXX)
+  else
+    LOCAL_CXX := $($(my_prefix)CXX)
+  endif
 endif
 $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(LOCAL_CXX)
 
@@ -247,7 +268,7 @@
 proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
 proto_generated_cc_sources_dir := $(intermediates)/proto
 proto_generated_cc_sources := $(addprefix $(proto_generated_cc_sources_dir)/, \
-	$(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
+    $(patsubst %.proto,%.pb.cc,$(proto_sources_fullpath)))
 proto_generated_objects := $(patsubst %.cc,%.o, $(proto_generated_cc_sources))
 
 $(proto_generated_cc_sources): PRIVATE_PROTO_INCLUDES := $(TOP)
@@ -261,7 +282,7 @@
 
 $(proto_generated_cc_sources): PRIVATE_ARM_MODE := $(normal_objects_mode)
 $(proto_generated_cc_sources): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc
+$(proto_generated_objects): $(proto_generated_cc_sources_dir)/%.o: $(proto_generated_cc_sources_dir)/%.cc $(proto_generated_headers)
 	$(transform-$(PRIVATE_HOST)cpp-to-o)
 -include $(proto_generated_objects:%.o=%.P)
 
@@ -281,14 +302,14 @@
 
 yacc_sources := $(filter %.y,$(LOCAL_SRC_FILES))
 yacc_cpps := $(addprefix \
-	$(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
+    $(intermediates)/,$(yacc_sources:.y=$(LOCAL_CPP_EXTENSION)))
 yacc_headers := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.h)
 yacc_objects := $(yacc_cpps:$(LOCAL_CPP_EXTENSION)=.o)
 
 ifneq ($(strip $(yacc_cpps)),)
 $(yacc_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
-		$(TOPDIR)$(LOCAL_PATH)/%.y \
-		$(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+    $(TOPDIR)$(LOCAL_PATH)/%.y \
+    $(lex_cpps) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(call transform-y-to-cpp,$(PRIVATE_CPP_EXTENSION))
 $(yacc_headers): $(intermediates)/%.h: $(intermediates)/%$(LOCAL_CPP_EXTENSION)
 
@@ -304,20 +325,20 @@
 
 lex_sources := $(filter %.l,$(LOCAL_SRC_FILES))
 lex_cpps := $(addprefix \
-	$(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
+    $(intermediates)/,$(lex_sources:.l=$(LOCAL_CPP_EXTENSION)))
 lex_objects := $(lex_cpps:$(LOCAL_CPP_EXTENSION)=.o)
 
 ifneq ($(strip $(lex_cpps)),)
 $(lex_cpps): $(intermediates)/%$(LOCAL_CPP_EXTENSION): \
-		$(TOPDIR)$(LOCAL_PATH)/%.l
+    $(TOPDIR)$(LOCAL_PATH)/%.l
 	$(transform-l-to-cpp)
 
 $(lex_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
 $(lex_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
 $(lex_objects): $(intermediates)/%.o: \
-		$(intermediates)/%$(LOCAL_CPP_EXTENSION) \
-		$(LOCAL_ADDITIONAL_DEPENDENCIES) \
-		$(yacc_headers)
+    $(intermediates)/%$(LOCAL_CPP_EXTENSION) \
+    $(LOCAL_ADDITIONAL_DEPENDENCIES) \
+    $(yacc_headers)
 	$(transform-$(PRIVATE_HOST)cpp-to-o)
 endif
 
@@ -342,8 +363,9 @@
 
 ifneq ($(strip $(cpp_objects)),)
 $(cpp_objects): $(intermediates)/%.o: \
-		$(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
-		$(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+    $(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
+    $(yacc_cpps) $(proto_generated_headers) $(my_compiler_dependencies) \
+    $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)cpp-to-o)
 -include $(cpp_objects:%.o=%.P)
 endif
@@ -360,7 +382,10 @@
 # TODO: support compiling certain generated files as arm.
 $(gen_cpp_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
 $(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(gen_cpp_objects): $(intermediates)/%.o: $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_cpp_objects): $(intermediates)/%.o: \
+    $(intermediates)/%$(LOCAL_CPP_EXTENSION) $(yacc_cpps) \
+    $(proto_generated_headers)  $(my_compiler_dependencies) \
+    $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)cpp-to-o)
 -include $(gen_cpp_objects:%.o=%.P)
 endif
@@ -373,7 +398,8 @@
 gen_S_objects := $(gen_S_sources:%.S=%.o)
 
 ifneq ($(strip $(gen_S_sources)),)
-$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
+    $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)s-to-o)
 -include $(gen_S_objects:%.o=%.P)
 endif
@@ -382,7 +408,8 @@
 gen_s_objects := $(gen_s_sources:%.s=%.o)
 
 ifneq ($(strip $(gen_s_objects)),)
-$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
+    $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
 -include $(gen_s_objects:%.o=%.P)
 endif
@@ -407,7 +434,8 @@
 c_objects        := $(c_arm_objects) $(c_normal_objects)
 
 ifneq ($(strip $(c_objects)),)
-$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c $(yacc_cpps) $(proto_generated_headers) \
+    $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)c-to-o)
 -include $(c_objects:%.o=%.P)
 endif
@@ -424,7 +452,8 @@
 # TODO: support compiling certain generated files as arm.
 $(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
 $(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
-$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c $(yacc_cpps) $(proto_generated_headers) \
+    $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)c-to-o)
 -include $(gen_c_objects:%.o=%.P)
 endif
@@ -437,7 +466,8 @@
 objc_objects := $(addprefix $(intermediates)/,$(objc_sources:.m=.o))
 
 ifneq ($(strip $(objc_objects)),)
-$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m $(yacc_cpps) $(proto_generated_headers) \
+    $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)m-to-o)
 -include $(objc_objects:%.o=%.P)
 endif
@@ -450,7 +480,8 @@
 asm_objects_S := $(addprefix $(intermediates)/,$(asm_sources_S:.S=.o))
 
 ifneq ($(strip $(asm_objects_S)),)
-$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
+    $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)s-to-o)
 -include $(asm_objects_S:%.o=%.P)
 endif
@@ -459,7 +490,8 @@
 asm_objects_s := $(addprefix $(intermediates)/,$(asm_sources_s:.s=.o))
 
 ifneq ($(strip $(asm_objects_s)),)
-$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s $(LOCAL_ADDITIONAL_DEPENDENCIES)
+$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
+    $(my_compiler_dependencies) $(LOCAL_ADDITIONAL_DEPENDENCIES)
 	$(transform-$(PRIVATE_HOST)s-to-o-no-deps)
 -include $(asm_objects_s:%.o=%.P)
 endif
@@ -474,19 +506,19 @@
 # some rules depend on asm_objects being first.  If your code depends on
 # being first, it's reasonable to require it to be assembly
 all_objects := \
-	$(asm_objects) \
-	$(cpp_objects) \
-	$(gen_cpp_objects) \
-	$(gen_asm_objects) \
-	$(c_objects) \
-	$(gen_c_objects) \
-	$(objc_objects) \
-	$(yacc_objects) \
-	$(lex_objects) \
-	$(proto_generated_objects) \
-	$(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
+    $(asm_objects) \
+    $(cpp_objects) \
+    $(gen_cpp_objects) \
+    $(gen_asm_objects) \
+    $(c_objects) \
+    $(gen_c_objects) \
+    $(objc_objects) \
+    $(yacc_objects) \
+    $(lex_objects) \
+    $(proto_generated_objects) \
+    $(addprefix $(TOPDIR)$(LOCAL_PATH)/,$(LOCAL_PREBUILT_OBJ_FILES))
 
-LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(base_intermediates)
+LOCAL_C_INCLUDES += $(TOPDIR)$(LOCAL_PATH) $(intermediates)
 
 ifndef LOCAL_NDK_VERSION
   LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
@@ -571,7 +603,7 @@
 # We don't care about installed static libraries, since the
 # libraries have already been linked into the module at that point.
 # We do, however, care about the NOTICE files for any static
-# libraries that we use. (see notice_files.make)
+# libraries that we use. (see notice_files.mk)
 
 installed_static_library_notice_file_targets := \
     $(foreach lib,$(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 63f44b3..41259e4 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -118,6 +118,7 @@
 LOCAL_MODULE_OWNER:=
 LOCAL_CTS_TEST_PACKAGE:=
 LOCAL_CTS_TEST_RUNNER:=
+LOCAL_CLANG:=
 
 # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
 # iterate over thousands of entries every time.
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 711041d..ca12ba2 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -43,7 +43,7 @@
 
 # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
 ifeq ($(strip $(TARGET_TOOLS_PREFIX)),)
-TARGET_TOOLCHAIN_ROOT := prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x
+TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-4.6
 TARGET_TOOLS_PREFIX := $(TARGET_TOOLCHAIN_ROOT)/bin/arm-linux-androideabi-
 endif
 
diff --git a/core/config.mk b/core/config.mk
index 56ef97e..dabdfde 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -31,9 +31,9 @@
 	$(TOPDIR)dalvik/libnativehelper/include \
 	$(TOPDIR)frameworks/native/include \
 	$(TOPDIR)frameworks/native/opengl/include \
+	$(TOPDIR)frameworks/av/include \
 	$(TOPDIR)frameworks/base/include \
 	$(TOPDIR)frameworks/base/opengl/include \
-	$(TOPDIR)frameworks/base/native/include \
 	$(TOPDIR)external/skia/include
 SRC_HOST_HEADERS:=$(TOPDIR)tools/include
 SRC_LIBRARIES:= $(TOPDIR)libs
@@ -151,12 +151,43 @@
 TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(board_config_mk)))
 board_config_mk :=
 
-# pull in device specific kernel headers. Files should be in
-# $(TARGET_DEVICE_DIR)/kernel-headers, e.g.
-# $(TARGET_DEVICE_DIR)/kernel-headers/linux/
-# $(TARGET_DEVICE_DIR)/kernel-headers/media/
-# $(TARGET_DEVICE_DIR)/kernel-headers/video/
-# etc.
+# The build system exposes several variables for where to find the kernel
+# headers:
+#   TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
+#       device being built. It is set as $(TARGET_DEVICE_DIR)/kernel-headers,
+#       e.g. device/samsung/tuna/kernel-headers. This directory is not
+#       explicitly set by anyone, the build system always adds this subdir.
+#
+#   TARGET_BOARD_KERNEL_HEADERS is specified by the BoardConfig.mk file
+#       to allow other directories to be included. This is useful if there's
+#       some common place where a few headers are being kept for a group
+#       of devices. For example, device/<vendor>/common/kernel-headers could
+#       contain some headers for several of <vendor>'s devices.
+#
+#   TARGET_PRODUCT_KERNEL_HEADERS is generated by the product inheritance
+#       graph. This allows architecture products to provide headers for the
+#       devices using that architecture. For example,
+#       hardware/ti/omap4xxx/omap4.mk will specify
+#       PRODUCT_VENDOR_KERNEL_HEADERS variable that specify where the omap4
+#       specific headers are, e.g. hardware/ti/omap4xxx/kernel-headers.
+#       The build system then combines all the values specified by all the
+#       PRODUCT_VENDOR_KERNEL_HEADERS directives in the product inheritance
+#       tree and then exports a TARGET_PRODUCT_KERNEL_HEADERS variable.
+#
+# The layout of subdirs in any of the kernel-headers dir should mirror the
+# layout of the kernel include/ directory. For example,
+#     device/samsung/tuna/kernel-headers/linux/,
+#     hardware/ti/omap4xxx/kernel-headers/media/,
+#     etc.
+#
+# NOTE: These directories MUST contain post-processed headers using the
+# bionic/libc/kernel/clean_header.py tool. Additionally, the original kernel
+# headers must also be checked in, but in a different subdirectory. By
+# convention, the originals should be checked into original-kernel-headers
+# directory of the same parent dir. For example,
+#     device/samsung/tuna/kernel-headers            <----- post-processed
+#     device/samsung/tuna/original-kernel-headers   <----- originals
+#
 TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
 
 define validate-kernel-headers
@@ -358,7 +389,8 @@
 
 HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
 TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
-		$(TARGET_OUT_KERNEL_HEADERS)
+		$(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \
+		$(TARGET_PRODUCT_KERNEL_HEADERS)
 
 # Many host compilers don't support these flags, so we have to make
 # sure to only specify them for the target compilers checked in to
@@ -372,6 +404,9 @@
 TARGET_GLOBAL_CFLAGS += $(TARGET_RELEASE_CFLAGS)
 TARGET_GLOBAL_CPPFLAGS += $(TARGET_RELEASE_CPPFLAGS)
 
+# define llvm tools and global flags
+include $(BUILD_SYSTEM)/llvm_config.mk
+
 PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true)
 
 # ###############################################################
diff --git a/core/definitions.mk b/core/definitions.mk
index 4f13133..0b7092f 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -1927,6 +1927,21 @@
 	$$(transform-prebuilt-to-target)
 endef
 
+# Version of add-radio-file that also arranges for the version of the
+# file to be checked against the contents of
+# $(TARGET_BOARD_INFO_FILE).
+# $(1): filename
+# $(2): name of version variable in board-info (eg, "version-baseband")
+define add-radio-file-checked
+  $(eval $(call add-radio-file-checked-internal,$(1),$(notdir $(1)),$(2)))
+endef
+define add-radio-file-checked-internal
+INSTALLED_RADIOIMAGE_TARGET += $$(PRODUCT_OUT)/$(2)
+BOARD_INFO_CHECK += $(3):$(LOCAL_PATH)/$(1)
+$$(PRODUCT_OUT)/$(2) : $$(LOCAL_PATH)/$(1) | $$(ACP)
+	$$(transform-prebuilt-to-target)
+endef
+
 
 ###########################################################
 # Override the package defined in $(1), setting the
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index b801ac2..38982c0 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -4,7 +4,7 @@
 ####################################
 
 # TODO: replace it with device's BOOTCLASSPATH
-DEXPREOPT_BOOT_JARS := core:core-junit:bouncycastle:ext:framework:android.policy:services:apache-xml:filterfw
+DEXPREOPT_BOOT_JARS := core:core-junit:bouncycastle:ext:framework:android.policy:services:apache-xml
 DEXPREOPT_BOOT_JARS_MODULES := $(subst :, ,$(DEXPREOPT_BOOT_JARS))
 
 DEXPREOPT_BUILD_DIR := $(OUT_DIR)
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index 87f7086..0f7dd8f 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -10,18 +10,19 @@
 endif
 
 # Add the ARM toolchain bin dir if it actually exists
-ifneq ($(wildcard $(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin),)
+ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-4.6/bin),)
 	# this should be copied to HOST_OUT_EXECUTABLES instead
-	ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin
+	ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/arm/arm-linux-androideabi-4.6/bin
 endif
 
 # Add the x86 toolchain bin dir if it actually exists
 ifneq ($(wildcard $(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-android-linux-4.4.3/bin),)
 	# this should be copied to HOST_OUT_EXECUTABLES instead
-	ABP:=$(ABP):$(PWD)/prebuilts/gcc//$(HOST_PREBUILT_TAG)/x86/i686-android-linux-4.4.3/bin
+	ABP:=$(ABP):$(PWD)/prebuilts/gcc/$(HOST_PREBUILT_TAG)/x86/i686-android-linux-4.4.3/bin
 endif
 ANDROID_BUILD_PATHS := $(ABP)
 ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
+ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
 
 # The "dumpvar" stuff lets you say something like
 #
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 9cc32c3..74e9100 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -191,7 +191,6 @@
 
 TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
 TARGET_OUT_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/include
-TARGET_OUT_KERNEL_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/kernel-headers
 TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib
 TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj
 
diff --git a/core/java.mk b/core/java.mk
index 38fd6f2..f0fe125 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -29,7 +29,7 @@
   endif
 else
   ifneq ($(LOCAL_NO_STANDARD_LIBRARIES),true)
-    LOCAL_JAVA_LIBRARIES := core core-junit ext framework filterfw $(LOCAL_JAVA_LIBRARIES)
+    LOCAL_JAVA_LIBRARIES := core core-junit ext framework $(LOCAL_JAVA_LIBRARIES)
   endif
 endif
 
@@ -166,7 +166,7 @@
 else
 LOCAL_RENDERSCRIPT_INCLUDES := \
     $(TOPDIR)external/clang/lib/Headers \
-    $(TOPDIR)frameworks/base/libs/rs/scriptc \
+    $(TOPDIR)frameworks/rs/scriptc \
     $(LOCAL_RENDERSCRIPT_INCLUDES)
 endif
 
diff --git a/core/java_library.mk b/core/java_library.mk
index 904ef5f..06cdfc4 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -92,6 +92,7 @@
 $(built_odex) : $(common_javalib.jar) | $(DEXPREOPT) $(DEXOPT)
 	@echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)"
 	$(hide) rm -f $@
+	@mkdir -p $(dir $@)
 	$(call dexpreopt-one-file,$<,$@)
 
 $(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) $(AAPT)
diff --git a/core/llvm_config.mk b/core/llvm_config.mk
new file mode 100644
index 0000000..ffa933d
--- /dev/null
+++ b/core/llvm_config.mk
@@ -0,0 +1,61 @@
+CLANG := $(HOST_OUT_EXECUTABLES)/clang$(HOST_EXECUTABLE_SUFFIX)
+CLANG_CXX := $(HOST_OUT_EXECUTABLES)/clang++$(HOST_EXECUTABLE_SUFFIX)
+LLVM_LINK := $(HOST_OUT_EXECUTABLES)/llvm-link$(HOST_EXECUTABLE_SUFFIX)
+
+define do-clang-flags-subst
+  TARGET_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(TARGET_GLOBAL_CLANG_FLAGS))
+  HOST_GLOBAL_CLANG_FLAGS := $(subst $(1),$(2),$(HOST_GLOBAL_CLANG_FLAGS))
+endef
+
+define clang-flags-subst
+  $(eval $(call do-clang-flags-subst,$(1),$(2)))
+endef
+
+
+CLANG_CONFIG_EXTRA_CFLAGS := \
+  -D__compiler_offsetof=__builtin_offsetof \
+  -Dnan=__builtin_nan \
+
+CLANG_CONFIG_UNKNOWN_CFLAGS := \
+  -funswitch-loops
+
+ifeq ($(TARGET_ARCH),arm)
+  CLANG_CONFIG_EXTRA_CFLAGS += \
+    -target arm-linux-androideabi \
+    -nostdlibinc \
+    -B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin \
+    -mllvm -arm-enable-ehabi
+  CLANG_CONFIG_EXTRA_LDFLAGS += \
+    -target arm-linux-androideabi \
+    -B$(TARGET_TOOLCHAIN_ROOT)/arm-linux-androideabi/bin
+  CLANG_CONFIG_UNKNOWN_CFLAGS += \
+    -mthumb-interwork \
+    -fgcse-after-reload \
+    -frerun-cse-after-loop \
+    -frename-registers \
+    -Wa,--noexecstack
+endif
+ifeq ($(TARGET_ARCH),x86)
+  CLANG_CONFIG_EXTRA_CFLAGS += \
+    -target i686-android-linux \
+    -nostdlibinc \
+    -B$(TARGET_TOOLCHAIN_ROOT)/i686-android-linux/bin
+  CLANG_CONFIG_EXTRA_LDFLAGS += \
+    -target i686-android-linux \
+    -B$(TARGET_TOOLCHAIN_ROOT)/i686-android-linux/bin
+  CLANG_CONFIG_UNKNOWN_CFLAGS += \
+    -finline-limit=300 \
+    -fno-inline-functions-called-once \
+    -mfpmath=sse \
+    -mbionic
+endif
+
+CLANG_CONFIG_EXTRA_C_INCLUDES := external/clang/lib/Headers
+
+# remove unknown flags to define CLANG_FLAGS
+TARGET_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(TARGET_GLOBAL_CFLAGS))
+HOST_GLOBAL_CLANG_FLAGS += $(filter-out $(CLANG_CONFIG_UNKNOWN_CFLAGS),$(HOST_GLOBAL_CFLAGS))
+
+# llvm does not yet support -march=armv5e nor -march=armv5te, fall back to armv5 or armv5t
+$(call clang-flags-subst,-march=armv5te,-march=armv5t)
+$(call clang-flags-subst,-march=armv5e,-march=armv5)
diff --git a/core/main.mk b/core/main.mk
index ab9d52d..15e8973 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -209,29 +209,8 @@
 
 # -----------------------------------------------------------------
 # The pdk (Platform Development Kit) build
-# pdk_eng : for building binary blob necessary for pdk_rel build
-# pdk_rel : HAL build for chipset vendors
+include build/core/pdk_config.mk
 
-PDK_BUILD_TYPE:= $(filter pdk_eng pdk_rel,$(MAKECMDGOALS))
-ifeq (2,$(words $(PDK_BUILD_TYPE)))
-  $(error You can't build pdk_eng and pdk_rel in the same run.)
-endif
-ifneq ($(PDK_BUILD_TYPE),)
-  $(info PDK build type $(PDK_BUILD_TYPE))
-  BUILD_PDK:= true
-  include pdk/build/pdk.mk
-  # force droid target
-  MAKECMDGOALS:= $(subst $(PDK_BUILD_TYPE),droid,$(MAKECMDGOALS))
-ifeq ($(PDK_BUILD_TYPE), pdk_eng)
-  .PHONY: pdk_eng
-  pdk_eng: droid pdk_bin_zip
-
-else  # pdk_rel
-  .PHONY: pdk_rel
-  pdk_rel: droid
-
-endif # pdk_rel
-endif # PDK_BUILD_TYPE
 # -----------------------------------------------------------------
 ###
 ### In this section we set up the things that are different
@@ -348,17 +327,6 @@
   ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dexopt-flags=m=y
 endif
 
-ifneq ($(BUILD_TINY_ANDROID),true)
-# Install an apns-conf.xml file if one's not already being installed.
-ifeq (,$(filter %:system/etc/apns-conf.xml, $(PRODUCT_COPY_FILES)))
-  PRODUCT_COPY_FILES += \
-        development/data/etc/apns-conf_sdk.xml:system/etc/apns-conf.xml
-  ifeq ($(filter eng tests,$(TARGET_BUILD_VARIANT)),)
-    $(warning implicitly installing apns-conf_sdk.xml)
-  endif
-endif
-endif
-
 ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
 
 # enable vm tracing in files for now to help track
@@ -447,10 +415,6 @@
 	external/yaffs2 \
 	external/zlib
 else	# !BUILD_TINY_ANDROID
-ifneq ($(BUILD_PDK),)
-subdirs := $(BUILD_PDK_SUBDIRS)
-FULL_BUILD := true
-else # Normal droid build
 #
 # Typical build; include any Android.mk files we can find.
 #
@@ -458,8 +422,6 @@
 
 FULL_BUILD := true
 
-endif  # !BUILD_PDK
-
 endif	# !BUILD_TINY_ANDROID
 
 endif	# !SDK_ONLY
@@ -729,9 +691,6 @@
 ifeq ($(BUILD_TINY_ANDROID), true)
 INSTALLED_RECOVERYIMAGE_TARGET :=
 endif
-ifneq ($(BUILD_PDK),)
-INSTALLED_RECOVERYIMAGE_TARGET :=
-endif
 
 # Build files and then package it into the rom formats
 .PHONY: droidcore
@@ -779,9 +738,6 @@
     $(INTERNAL_UPDATE_PACKAGE_TARGET) \
     $(INTERNAL_OTA_PACKAGE_TARGET) \
     $(SYMBOLS_ZIP) \
-    $(APPS_ZIP) \
-    $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
-    $(PACKAGE_STATS_FILE) \
     $(INSTALLED_FILES_FILE) \
     $(INSTALLED_BUILD_PROP_TARGET) \
     $(BUILT_TARGET_FILES_PACKAGE) \
@@ -790,6 +746,14 @@
     $(INSTALLED_FACTORY_RAMDISK_TARGET) \
    )
 
+  ifneq ($(TARGET_BUILD_PDK),true)
+    $(call dist-for-goals, droidcore, \
+      $(APPS_ZIP) \
+      $(INTERNAL_EMULATOR_PACKAGE_TARGET) \
+      $(PACKAGE_STATS_FILE) \
+    )
+  endif
+
 # Building a full system-- the default is to build droidcore
 droid: droidcore dist_files
 
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 235f775..71fc638 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -53,8 +53,8 @@
     system-core:system/core/include \
     audio-effects:system/media/audio_effects/include \
     audio-utils:system/media/audio_utils/include \
-    wilhelm:system/media/wilhelm/include \
-    wilhelm-ut:system/media/wilhelm/src/ut \
+    wilhelm:frameworks/wilhelm/include \
+    wilhelm-ut:frameworks/wilhelm/src/ut \
     speex:external/speex/include
 
 #
@@ -89,6 +89,9 @@
 	    graphics \
 	    location \
 	    media \
+	    media/mca/effect \
+	    media/mca/filterfw \
+	    media/mca/filterpacks \
 	    drm \
 	    opengl \
 	    sax \
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
new file mode 100644
index 0000000..98f34a5
--- /dev/null
+++ b/core/pdk_config.mk
@@ -0,0 +1,66 @@
+# This file defines the rule to fuse the platform.zip into the current PDK build.
+
+.PHONY: pdk fusion
+pdk fusion: $(DEFAULT_GOAL)
+
+# What to build:
+# pdk fusion if:
+# 1) the platform.zip exists in the default location
+# or
+# 2) PDK_FUSION_PLATFORM_ZIP is passed in from the environment
+# or
+# 3) fusion is a command line build goal,
+#    PDK_FUSION_PLATFORM_ZIP is needed anyway, then do we need the 'fusion' goal?
+# otherwise pdk only if:
+# 1) pdk is a command line build goal
+# or
+# 2) TARGET_BUILD_PDK is passed in from the environment
+
+# TODO: what's the best default location?
+_pdk_fusion_default_platform_zip := $(OUT_DIR)/platform.zip
+ifneq (,$(wildcard $(_pdk_fusion_default_platform_zip)))
+$(info $(_pdk_fusion_default_platform_zip) found, do a PDK fusion build.)
+PDK_FUSION_PLATFORM_ZIP := $(_pdk_fusion_default_platform_zip)
+TARGET_BUILD_PDK := true
+endif
+
+ifneq (,$(filter pdk fusion, $(MAKECMDGOALS)))
+TARGET_BUILD_PDK := true
+ifneq (,$(filter fusion, $(MAKECMDGOALS)))
+ifndef PDK_FUSION_PLATFORM_ZIP
+  $(error Specify PDK_FUSION_PLATFORM_ZIP to do a PDK fusion.)
+endif
+endif  # fusion
+endif  # pdk or fusion
+
+ifdef PDK_FUSION_PLATFORM_ZIP
+TARGET_BUILD_PDK := true
+ifeq (,$(wildcard $(PDK_FUSION_PLATFORM_ZIP)))
+  $(error Cannot find file $(PDK_FUSION_PLATFORM_ZIP).)
+endif
+
+_pdk_fusion_intermediates := $(call intermediates-dir-for, PACKAGING, pdk_fusion)
+_pdk_fusion_stamp := $(_pdk_fusion_intermediates)/pdk_fusion.stamp
+
+$(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP)
+	@echo "Unzip $(dir $@) <- $<"
+	$(hide) rm -rf $(dir $@) && mkdir -p $(dir $@)
+	$(hide) unzip -qo $< -d $(dir $@)
+	$(hide) touch $@
+
+_pdk_fusion_file_list := $(shell unzip -Z -1 $(PDK_FUSION_PLATFORM_ZIP) '*[^/]' 2>/dev/null)
+_pdk_fusion_files := $(addprefix $(_pdk_fusion_intermediates)/, $(_pdk_fusion_file_list))
+$(_pdk_fusion_files) : $(_pdk_fusion_stamp)
+
+# Implicit pattern rules to copy the fusion files to the system image directory.
+# Note that if there is already explicit rule in the build system to generate a file,
+# the pattern rule will be just ignored by make.
+# That's desired by us: we want only absent files from the platform zip package.
+# Copy with the last-modified time preserved, never follow symbolic links.
+$(PRODUCT_OUT)/% : $(_pdk_fusion_intermediates)/%
+	@mkdir -p $(dir $@)
+	$(hide) cp -fpPR $< $@
+
+ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
+
+endif
diff --git a/core/tasks/apicheck.mk b/core/tasks/apicheck.mk
index b3d800b..8d9928e 100644
--- a/core/tasks/apicheck.mk
+++ b/core/tasks/apicheck.mk
@@ -18,7 +18,7 @@
 #
 
 # skip api check for TINY_ANDROID and PDK buid
-ifeq (,$(filter true, $(BUILD_TINY_ANDROID) $(BUILD_PDK)))
+ifeq (,$(filter true, $(BUILD_TINY_ANDROID) $(TARGET_BUILD_PDK)))
 
 .PHONY: checkapi
 
diff --git a/core/tasks/factory_ramdisk.mk b/core/tasks/factory_ramdisk.mk
index ecfc4d0..2cbea87 100644
--- a/core/tasks/factory_ramdisk.mk
+++ b/core/tasks/factory_ramdisk.mk
@@ -60,14 +60,26 @@
 
 ifneq (,$(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES)$(INTERNAL_FACTORY_RAMDISK_FILES))
 
+# These files are made by magic in build/core/Makefile so we need to explicitly include them
+$(eval $(call copy-one-file,$(TARGET_OUT)/build.prop,$(TARGET_FACTORY_RAMDISK_OUT)/system/build.prop))
+INTERNAL_FACTORY_RAMDISK_FILES += $(TARGET_FACTORY_RAMDISK_OUT)/system/build.prop
+
+BUILT_FACTORY_RAMDISK_FS := $(PRODUCT_OUT)/factory_ramdisk.gz
 BUILT_FACTORY_RAMDISK_TARGET := $(PRODUCT_OUT)/factory_ramdisk.img
 
-INSTALLED_FACTORY_RAMDISK_TARGET := $(BUILT_FACTORY_RAMDISK_TARGET)
-$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTFS) \
+INSTALLED_FACTORY_RAMDISK_FS := $(BUILT_FACTORY_RAMDISK_FS)
+$(INSTALLED_FACTORY_RAMDISK_FS) : $(MKBOOTFS) \
     $(INTERNAL_FACTORY_RAMDISK_EXTRA_MODULES_FILES) $(INTERNAL_FACTORY_RAMDISK_FILES) | $(MINIGZIP)
-	$(call pretty,"Target factory ram disk: $@")
+	$(call pretty,"Target factory ram disk file system: $@")
 	$(hide) $(MKBOOTFS) $(TARGET_FACTORY_RAMDISK_OUT) | $(MINIGZIP) > $@
 
+TARGET_RAMDISK_KERNEL := $(INSTALLED_KERNEL_TARGET)
+INSTALLED_FACTORY_RAMDISK_TARGET := $(BUILT_FACTORY_RAMDISK_TARGET)
+$(INSTALLED_FACTORY_RAMDISK_TARGET) : $(MKBOOTIMG) $(TARGET_RAMDISK_KERNEL) $(INSTALLED_FACTORY_RAMDISK_FS)
+	$(call pretty,"Target factory ram disk img format: $@")
+	$(MKBOOTIMG) --kernel $(TARGET_RAMDISK_KERNEL) --ramdisk $(INSTALLED_FACTORY_RAMDISK_FS) \
+            --base $(BOARD_KERNEL_BASE) --output $@
+
 endif
 
 endif # ONE_SHOT_MAKEFILE
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index c2d6c78..ca0ad8d 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -22,6 +22,7 @@
 	invensense \
 	nxp \
 	samsung \
+	samsung_arm \
 	ti
 
 
diff --git a/core/user_tags.mk b/core/user_tags.mk
index 29ceca7..4c0710f 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -164,7 +164,6 @@
 	jsr305lib \
 	junit \
 	jython \
-	keystore \
 	kxml2-2.3.0 \
 	launch-wrapper \
 	layoutlib \
diff --git a/envsetup.sh b/envsetup.sh
index f11763a..7711e0d 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -112,18 +112,19 @@
     # and in with the new
     CODE_REVIEWS=
     prebuiltdir=$(getprebuilt)
+    gccprebuiltdir=$(get_abs_build_var ANDROID_GCC_PREBUILTS)
 
     # The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
     export ANDROID_EABI_TOOLCHAIN=
-    toolchaindir=toolchain/arm-linux-androideabi-4.4.x/bin
-    if [ -d "$prebuiltdir/$toolchaindir" ]; then
-        export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir
+    toolchaindir=arm/arm-linux-androideabi-4.6/bin
+    if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
+        export ANDROID_EABI_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
     fi
 
     export ARM_EABI_TOOLCHAIN=
-    toolchaindir=toolchain/arm-eabi-4.4.3/bin
-    if [ -d "$prebuiltdir/$toolchaindir" ]; then
-        export ARM_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir
+    toolchaindir=arm/arm-eabi-4.6/bin
+    if [ -d "$gccprebuiltdir/$toolchaindir" ]; then
+        export ARM_EABI_TOOLCHAIN=$gccprebuiltdir/$toolchaindir
     fi
 
     export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
@@ -757,7 +758,7 @@
        fi
 
        echo >|"$OUT_ROOT/gdbclient.cmds" "set solib-absolute-prefix $OUT_SYMBOLS"
-       echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS"
+       echo >>"$OUT_ROOT/gdbclient.cmds" "set solib-search-path $OUT_SO_SYMBOLS:$OUT_SO_SYMBOLS/hw:$OUT_SO_SYMBOLS/ssl/engines"
        echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
        echo >>"$OUT_ROOT/gdbclient.cmds" ""
 
diff --git a/target/board/Android.mk b/target/board/Android.mk
index 6f3bf91..7d94ee0 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -36,6 +36,7 @@
 board_info_txt := $(wildcard $(TARGET_DEVICE_DIR)/board-info.txt)
 endif
 $(INSTALLED_ANDROID_INFO_TXT_TARGET): $(board_info_txt)
+	$(hide) build/tools/check_radio_versions.py $< $(BOARD_INFO_CHECK)
 	$(call pretty,"Generated: ($@)")
 ifdef board_info_txt
 	$(hide) grep -v '#' $< > $@
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index 0dd2bc0..3a1d2f0 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -26,3 +26,4 @@
     development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     development/data/etc/vold.conf:system/etc/vold.conf \
     development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
diff --git a/target/board/vbox_x86/device.mk b/target/board/vbox_x86/device.mk
index 07ebb1c..a650ed6 100644
--- a/target/board/vbox_x86/device.mk
+++ b/target/board/vbox_x86/device.mk
@@ -30,6 +30,7 @@
     development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     development/data/etc/vold.conf:system/etc/vold.conf \
     development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
     build/target/board/vbox_x86/init.rc:root/init.rc \
     build/target/board/vbox_x86/init.vbox_x86.rc:root/init.vbox_x86.rc \
     $(LOCAL_KERNEL):kernel
diff --git a/target/product/core.mk b/target/product/core.mk
index f655904..732e476 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -56,9 +56,9 @@
     dexlist \
     dexopt \
     dmtracedump \
+    drmserver \
     dx \
     ext \
-    filterfw \
     framework-res \
     hprof-conv \
     icu.dat \
@@ -67,6 +67,8 @@
     ip-up-vpn \
     ip6tables \
     iptables \
+    keystore \
+    keystore.default \
     libandroidfw \
     libOpenMAXAL \
     libOpenSLES \
@@ -74,12 +76,15 @@
     libaudioutils \
     libcrypto \
     libdvm \
+    libdrmframework \
+    libdrmframework_jni \
     libexpat \
     libfilterfw \
     libfilterpack_imageproc \
     libgabi++ \
     libicui18n \
     libicuuc \
+    libkeystore \
     libnativehelper \
     libnfc_ndef \
     libpowermanager \
@@ -97,6 +102,7 @@
     libstagefright_soft_mpeg4dec \
     libstagefright_soft_vorbisdec \
     libstagefright_soft_vpxdec \
+    libstagefright_soft_rawdec \
     libvariablespeed \
     libwebrtc_audio_preprocessing \
     libwilhelm \
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index b7c9b32..d8bda3e 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -62,13 +62,16 @@
     local_time.default \
     power.default
 
+PRODUCT_PACKAGES += \
+    local_time.default
+
 PRODUCT_COPY_FILES := \
         system/bluetooth/data/audio.conf:system/etc/bluetooth/audio.conf \
         system/bluetooth/data/auto_pairing.conf:system/etc/bluetooth/auto_pairing.conf \
         system/bluetooth/data/blacklist.conf:system/etc/bluetooth/blacklist.conf \
         system/bluetooth/data/input.conf:system/etc/bluetooth/input.conf \
         system/bluetooth/data/network.conf:system/etc/bluetooth/network.conf \
-        frameworks/base/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf
+        frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf
 
 $(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
 $(call inherit-product-if-exists, external/lohit-fonts/fonts.mk)
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 8b5674f..6bd685c 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -139,9 +139,11 @@
 	system/core/rootdir/etc/vold.fstab:system/etc/vold.fstab \
 	frameworks/base/data/sounds/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	frameworks/base/data/sounds/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
-	frameworks/base/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
-	frameworks/base/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
-	frameworks/base/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml
+	frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
+	development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
+	development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
+	frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
+	frameworks/native/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml
 
 $(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
 $(call inherit-product-if-exists, frameworks/base/data/keyboards/keyboards.mk)
diff --git a/tools/adbs b/tools/adbs
index 1a400f7..598af85 100755
--- a/tools/adbs
+++ b/tools/adbs
@@ -140,13 +140,13 @@
     uname = "darwin-x86"
   elif uname == "Linux":
     uname = "linux-x86"
-  prefix = "./prebuilt/" + uname + "/toolchain/arm-linux-androideabi-4.4.x/bin/"
+  prefix = "./prebuilts/gcc/" + uname + "/arm/arm-linux-androideabi-4.6/bin/"
   addr2line_cmd = prefix + "arm-linux-androideabi-addr2line"
 
   if (not os.path.exists(addr2line_cmd)):
     try:
-      prefix = os.environ['ANDROID_BUILD_TOP'] + "/prebuilt/" + uname + \
-               "/toolchain/arm-linux-androideabi-4.4.x/bin/"
+      prefix = os.environ['ANDROID_BUILD_TOP'] + "/prebuilts/gcc/" + \
+               uname + "/arm/arm-linux-androideabi-4.6/bin/"
     except:
       prefix = "";
 
diff --git a/tools/apicheck/Android.mk b/tools/apicheck/Android.mk
index 24f697c..1674a17 100644
--- a/tools/apicheck/Android.mk
+++ b/tools/apicheck/Android.mk
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+ifneq ($(TARGET_BUILD_PDK),true)
 LOCAL_PATH := $(call my-dir)
 
 # We use copy-file-to-new-target so that the installed
@@ -36,3 +37,4 @@
 	$(hide) chmod 755 $@
 
 # Apicheck is now part of Doclava -- See external/doclava.
+endif
diff --git a/tools/check_radio_versions.py b/tools/check_radio_versions.py
new file mode 100755
index 0000000..ebe621f
--- /dev/null
+++ b/tools/check_radio_versions.py
@@ -0,0 +1,79 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2012 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 sys
+import os
+
+try:
+  from hashlib import sha1
+except ImportError:
+  from sha import sha as sha1
+
+if len(sys.argv) < 2:
+  sys.exit(0)
+
+build_info = {}
+f = open(sys.argv[1])
+for line in f:
+  line = line.strip()
+  if line.startswith("require"):
+    key, value = line.split()[1].split("=", 1)
+    build_info[key] = value
+f.close()
+
+bad = False
+
+for item in sys.argv[2:]:
+  key, fn = item.split(":", 1)
+
+  values = build_info.get(key, None)
+  if not values:
+    continue
+  values = values.split("|")
+
+  f = open(fn, "rb")
+  digest = sha1(f.read()).hexdigest()
+  f.close()
+
+  versions = {}
+  try:
+    f = open(fn + ".sha1")
+  except IOError:
+    if not bad: print
+    print "*** Error opening \"%s.sha1\"; can't verify %s" % (fn, key)
+    bad = True
+    continue
+  for line in f:
+    line = line.strip()
+    if not line or line.startswith("#"): continue
+    h, v = line.split()
+    versions[h] = v
+
+  if digest not in versions:
+    if not bad: print
+    print "*** SHA-1 hash of \"%s\" doesn't appear in \"%s.sha1\"" % (fn, fn)
+    bad = True
+    continue
+
+  if versions[digest] not in values:
+    if not bad: print
+    print "*** \"%s\" is version %s; not any %s allowed by \"%s\"." % (
+        fn, versions[digest], key, sys.argv[1])
+    bad = True
+
+if bad:
+  print
+  sys.exit(1)
diff --git a/tools/droiddoc/templates-sdk/assets/android-developer-docs.css b/tools/droiddoc/templates-sdk/assets/android-developer-docs.css
index 6cc4a97..d346e31 100644
--- a/tools/droiddoc/templates-sdk/assets/android-developer-docs.css
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-docs.css
@@ -579,7 +579,7 @@
 
 #jd-content li img,
 #jd-content dd img {
-  margin:.5em 0 0 1em;
+  margin:.5em 0 .5em 1em;
 }
 
 .nolist {
@@ -713,7 +713,7 @@
   border-bottom:1px solid #33B5E5;
   padding:5px 10px 10px 55px;
   margin:2em 0;
-  background:url('../design/static/ico_styleguide.png') 5px 13px no-repeat;
+  background:url('images/icon_design.png') 5px 13px no-repeat;
 }
 
 div.design-announce p {
diff --git a/tools/droiddoc/templates-sdk/assets/images/icon_design.png b/tools/droiddoc/templates-sdk/assets/images/icon_design.png
new file mode 100644
index 0000000..c12907c
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/icon_design.png
Binary files differ
diff --git a/tools/generate-notice-files.py b/tools/generate-notice-files.py
new file mode 100755
index 0000000..4571b70
--- /dev/null
+++ b/tools/generate-notice-files.py
@@ -0,0 +1,188 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2012 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.
+"""
+Usage: generate-notice-files [plain text output file] [html output file] [file title] [directory of notices]
+
+Generate the Android notice files, including both text and html files.
+
+-h to display this usage message and exit.
+"""
+from collections import defaultdict
+import getopt
+import hashlib
+import itertools
+import os
+import os.path
+import re
+import sys
+
+MD5_BLOCKSIZE = 1024 * 1024
+HTML_ESCAPE_TABLE = {
+    "&": "&amp;",
+    '"': "&quot;",
+    "'": "&apos;",
+    ">": "&gt;",
+    "<": "&lt;",
+    }
+
+try:
+  opts, args = getopt.getopt(sys.argv[1:], "h")
+except getopt.GetoptError, err:
+    print str(err)
+    print __doc__
+    sys.exit(2)
+
+for o, a in opts:
+  if o == "-h":
+    print __doc__
+    sys.exit(2)
+  else:
+    print >> sys.stderr, "unhandled option %s" % (o,)
+
+if len(args) != 4:
+    print """need exactly four arguments, the two output files, the file title
+             and the directory containing notices, not %d""" % (len(args),)
+    print __doc__
+    sys.exit(1)
+
+def hexify(s):
+    return ("%02x"*len(s)) % tuple(map(ord, s))
+
+def md5sum(filename):
+    """Calculate an MD5 of the file given by FILENAME,
+    and return hex digest as a string.
+    Output should be compatible with md5sum command"""
+
+    f = open(filename, "rb")
+    sum = hashlib.md5()
+    while 1:
+        block = f.read(MD5_BLOCKSIZE)
+        if not block:
+            break
+        sum.update(block)
+    f.close()
+    return hexify(sum.digest())
+
+
+def html_escape(text):
+    """Produce entities within text."""
+    return "".join(HTML_ESCAPE_TABLE.get(c,c) for c in text)
+
+HTML_OUTPUT_CSS="""
+<style type="text/css">
+body { padding: 0; font-family: sans-serif; }
+.same-license { background-color: #eeeeee; border-top: 20px solid white; padding: 10px; }
+.label { font-weight: bold; }
+.file-list { margin-left: 1em; color: blue; }
+</style>
+"""
+
+def combine_notice_files_html(file_hash, input_dir, output_filename):
+    """Combine notice files in FILE_HASH and output a HTML version to OUTPUT_FILENAME."""
+
+    SRC_DIR_STRIP_RE = re.compile(input_dir + "(/.*).txt")
+
+    # Set up a filename to row id table (anchors inside tables don't work in
+    # most browsers, but href's to table row ids do)
+    id_table = {}
+    id_count = 0
+    for value in file_hash.values():
+        for filename in value:
+             id_table[filename] = id_count
+        id_count += 1
+
+    # Open the output file, and output the header pieces
+    output_file = open(output_filename, "wb")
+
+    print >> output_file, "<html><head>"
+    print >> output_file, HTML_OUTPUT_CSS
+    print >> output_file, '</head><body topmargin="0" leftmargin="0" rightmargin="0" bottommargin="0">'
+
+    # Output our table of contents
+    print >> output_file, '<div class="toc">'
+    print >> output_file, "<ul>"
+
+    # Flatten the list of lists into a single list of filenames
+    sorted_filenames = sorted(itertools.chain.from_iterable(file_hash.values()))
+
+    # Print out a nice table of contents
+    for filename in sorted_filenames:
+        stripped_filename = SRC_DIR_STRIP_RE.sub(r"\1", filename)
+        print >> output_file, '<li><a href="#id%d">%s</a></li>' % (id_table.get(filename), stripped_filename)
+
+    print >> output_file, "</ul>"
+    print >> output_file, "</div><!-- table of contents -->"
+    # Output the individual notice file lists
+    print >>output_file, '<table cellpadding="0" cellspacing="0" border="0">'
+    for value in file_hash.values():
+        print >> output_file, '<tr id="id%d"><td class="same-license">' % id_table.get(value[0])
+        print >> output_file, '<div class="label">Notices for file(s):</div>'
+        print >> output_file, '<div class="file-list">'
+        for filename in sorted(value):
+            print >> output_file, "%s <br/>" % (SRC_DIR_STRIP_RE.sub(r"\1", filename))
+        print >> output_file, "</div><!-- file-list -->"
+        print >> output_file
+        print >> output_file, '<pre class="license-text">'
+        print >> output_file, html_escape(open(value[0]).read())
+        print >> output_file, "</pre><!-- license-text -->"
+        print >> output_file, "</td></tr><!-- same-license -->"
+        print >> output_file
+        print >> output_file
+        print >> output_file
+
+    # Finish off the file output
+    print >> output_file, "</table>"
+    print >> output_file, "</body></html>"
+    output_file.close()
+
+def combine_notice_files_text(file_hash, input_dir, output_filename, file_title):
+    """Combine notice files in FILE_HASH and output a text version to OUTPUT_FILENAME."""
+
+    SRC_DIR_STRIP_RE = re.compile(input_dir + "(/.*).txt")
+    output_file = open(output_filename, "wb")
+    print >> output_file, file_title
+    for value in file_hash.values():
+      print >> output_file, "============================================================"
+      print >> output_file, "Notices for file(s):"
+      for filename in sorted(value):
+        print >> output_file, SRC_DIR_STRIP_RE.sub(r"\1", filename)
+      print >> output_file, "------------------------------------------------------------"
+      print >> output_file, open(value[0]).read()
+    output_file.close()
+
+def main(args):
+    txt_output_file = args[0]
+    html_output_file = args[1]
+    file_title = args[2]
+
+    # Find all the notice files and md5 them
+    input_dir = os.path.normpath(args[3])
+    files_with_same_hash = defaultdict(list)
+    for root, dir, files in os.walk(input_dir):
+        for file in files:
+            if file.endswith(".txt"):
+                filename = os.path.join(root, file)
+                file_md5sum = md5sum(filename)
+                files_with_same_hash[file_md5sum].append(filename)
+
+
+    print "Combining NOTICE files into HTML"
+    combine_notice_files_html(files_with_same_hash, input_dir, html_output_file)
+    print "Combining NOTICE files into text"
+    combine_notice_files_text(files_with_same_hash, input_dir, txt_output_file, file_title)
+
+if __name__ == "__main__":
+    main(args)
diff --git a/tools/zipalign/Android.mk b/tools/zipalign/Android.mk
index 8ed60df..9763bd2 100644
--- a/tools/zipalign/Android.mk
+++ b/tools/zipalign/Android.mk
@@ -15,7 +15,6 @@
 LOCAL_C_INCLUDES += external/zlib
 
 LOCAL_STATIC_LIBRARIES := \
-	libandroidfw \
 	libutils \
 	libcutils
 
diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp
index 8057068..3994c31 100644
--- a/tools/zipalign/ZipFile.cpp
+++ b/tools/zipalign/ZipFile.cpp
@@ -20,8 +20,8 @@
 
 #define LOG_TAG "zip"
 
-#include <androidfw/ZipUtils.h>
 #include <utils/Log.h>
+#include <utils/ZipUtils.h>
 
 #include "ZipFile.h"