Merge "Added media_codecs.xml file to generic_x86 and vbox_x86 configuration files"
diff --git a/core/config.mk b/core/config.mk
index b42e7dc..56ef97e 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -33,7 +33,7 @@
 	$(TOPDIR)frameworks/native/opengl/include \
 	$(TOPDIR)frameworks/base/include \
 	$(TOPDIR)frameworks/base/opengl/include \
-    $(TOPDIR)frameworks/base/native/include \
+	$(TOPDIR)frameworks/base/native/include \
 	$(TOPDIR)external/skia/include
 SRC_HOST_HEADERS:=$(TOPDIR)tools/include
 SRC_LIBRARIES:= $(TOPDIR)libs
@@ -151,6 +151,33 @@
 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.
+TARGET_DEVICE_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_DEVICE_DIR)/kernel-headers))
+
+define validate-kernel-headers
+$(if $(firstword $(foreach hdr_dir,$(1),\
+         $(filter-out kernel-headers,$(notdir $(hdr_dir))))),\
+     $(error Kernel header dirs must be end in kernel-headers: $(1)))
+endef
+# also allow the board config to provide additional directories since
+# there could be device/oem/base_hw and device/oem/derived_hw
+# that both are valid devices but derived_hw needs to use kernel headers
+# from base_hw.
+TARGET_BOARD_KERNEL_HEADERS := $(strip $(wildcard $(TARGET_BOARD_KERNEL_HEADERS)))
+TARGET_BOARD_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_BOARD_KERNEL_HEADERS))
+$(call validate-kernel-headers,$(TARGET_BOARD_KERNEL_HEADERS))
+
+# then add product-inherited includes, to allow for
+# hardware/sivendor/chip/chip.mk to include their own headers
+TARGET_PRODUCT_KERNEL_HEADERS := $(strip $(wildcard $(PRODUCT_VENDOR_KERNEL_HEADERS)))
+TARGET_PRODUCT_KERNEL_HEADERS := $(patsubst %/,%,$(TARGET_PRODUCT_KERNEL_HEADERS))
+$(call validate-kernel-headers,$(TARGET_PRODUCT_KERNEL_HEADERS))
+
 # Clean up/verify variables defined by the board config file.
 TARGET_BOOTLOADER_BOARD_NAME := $(strip $(TARGET_BOOTLOADER_BOARD_NAME))
 TARGET_CPU_ABI := $(strip $(TARGET_CPU_ABI))
@@ -330,7 +357,8 @@
 TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES)
 
 HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS)
-TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS)
+TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \
+		$(TARGET_OUT_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
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 74e9100..9cc32c3 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -191,6 +191,7 @@
 
 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/main.mk b/core/main.mk
index 0084a0b..ab9d52d 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -209,12 +209,12 @@
 
 # -----------------------------------------------------------------
 # The pdk (Platform Development Kit) build
-# pdk1 : for building binary blob necessary for pdk2 build
-# pdk2 : HAL build for chipset vendors
+# pdk_eng : for building binary blob necessary for pdk_rel build
+# pdk_rel : HAL build for chipset vendors
 
-PDK_BUILD_TYPE:= $(filter pdk1 pdk2,$(MAKECMDGOALS))
+PDK_BUILD_TYPE:= $(filter pdk_eng pdk_rel,$(MAKECMDGOALS))
 ifeq (2,$(words $(PDK_BUILD_TYPE)))
-  $(error You can't build pdk1 and pdk2 in the same run.)
+  $(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))
@@ -222,15 +222,15 @@
   include pdk/build/pdk.mk
   # force droid target
   MAKECMDGOALS:= $(subst $(PDK_BUILD_TYPE),droid,$(MAKECMDGOALS))
-ifeq ($(PDK_BUILD_TYPE), pdk1)
-  .PHONY: pdk1
-  pdk1: droid pdk_bin_zip
+ifeq ($(PDK_BUILD_TYPE), pdk_eng)
+  .PHONY: pdk_eng
+  pdk_eng: droid pdk_bin_zip
 
-else  # pdk2
-  .PHONY: pdk2
-  pdk2: droid
+else  # pdk_rel
+  .PHONY: pdk_rel
+  pdk_rel: droid
 
-endif # pdk2
+endif # pdk_rel
 endif # PDK_BUILD_TYPE
 # -----------------------------------------------------------------
 ###
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 041a7b0..235f775 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -51,6 +51,10 @@
     opengl-tests-includes:frameworks/native/opengl/tests/include \
     recovery:bootable/recovery \
     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 \
     speex:external/speex/include
 
 #
diff --git a/core/product.mk b/core/product.mk
index 23dc375..b001ca2 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -86,6 +86,7 @@
     PRODUCT_DEFAULT_DEV_CERTIFICATE \
     PRODUCT_RESTRICT_VENDOR_FILES \
     PRODUCT_FACTORY_RAMDISK_MODULES \
+    PRODUCT_VENDOR_KERNEL_HEADERS \
 
 
 define dump-product
@@ -201,6 +202,9 @@
 	TARGET_ARCH_VARIANT \
 	TARGET_BOARD_PLATFORM \
 	TARGET_BOARD_PLATFORM_GPU \
+	TARGET_BOARD_KERNEL_HEADERS \
+	TARGET_DEVICE_KERNEL_HEADERS \
+	TARGET_PRODUCT_KERNEL_HEADERS \
 	TARGET_BOOTLOADER_BOARD_NAME \
 	TARGET_COMPRESS_MODULE_SYMBOLS \
 	TARGET_NO_BOOTLOADER \
diff --git a/core/product_config.mk b/core/product_config.mk
index c455723..ea3e517 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -306,6 +306,10 @@
 # An list of whitespace-separated words.
 PRODUCT_TAGS := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_TAGS))
 
+# The list of product-specific kernel header dirs
+PRODUCT_VENDOR_KERNEL_HEADERS := \
+    $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_KERNEL_HEADERS)
+
 # Add the product-defined properties to the build properties.
 ADDITIONAL_BUILD_PROPERTIES := \
     $(ADDITIONAL_BUILD_PROPERTIES) \