Merge "Move pdk fusion platform.zip file under vendor/pdk"
diff --git a/core/Makefile b/core/Makefile
index ef802ab..05bc057 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -574,7 +574,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) $(TARGET_BUILD_PDK)))
+ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY) $(BUILD_TINY_ANDROID)))
 
 INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img
 
@@ -956,25 +956,24 @@
 endif
 
 # -----------------------------------------------------------------
-# host tools needed to build OTA packages
+# host tools needed to build dist and OTA packages
 
-OTATOOLS :=  $(HOST_OUT_EXECUTABLES)/minigzip \
+DISTTOOLS :=  $(HOST_OUT_EXECUTABLES)/minigzip \
 	  $(HOST_OUT_EXECUTABLES)/mkbootfs \
 	  $(HOST_OUT_EXECUTABLES)/mkbootimg \
 	  $(HOST_OUT_EXECUTABLES)/fs_config \
 	  $(HOST_OUT_EXECUTABLES)/mkyaffs2image \
 	  $(HOST_OUT_EXECUTABLES)/zipalign \
-	  $(HOST_OUT_EXECUTABLES)/aapt \
 	  $(HOST_OUT_EXECUTABLES)/bsdiff \
 	  $(HOST_OUT_EXECUTABLES)/imgdiff \
 	  $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar \
 	  $(HOST_OUT_JAVA_LIBRARIES)/signapk.jar \
 	  $(HOST_OUT_EXECUTABLES)/mkuserimg.sh \
-	  $(HOST_OUT_EXECUTABLES)/genext2fs \
-	  $(HOST_OUT_EXECUTABLES)/tune2fs \
-	  $(HOST_OUT_EXECUTABLES)/e2fsck \
 	  $(HOST_OUT_EXECUTABLES)/make_ext4fs
 
+OTATOOLS := $(DISTTOOLS) \
+	  $(HOST_OUT_EXECUTABLES)/aapt
+
 .PHONY: otatools
 otatools: $(OTATOOLS)
 
@@ -1143,7 +1142,7 @@
 
 $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
 
-$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS) $(SELINUX_DEPENDS)
+$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS) $(SELINUX_DEPENDS)
 	@echo "Package OTA: $@"
 	$(hide) ./build/tools/releasetools/ota_from_target_files -v \
 	   -p $(HOST_OUT) \
@@ -1171,7 +1170,7 @@
 $(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
 endif
 
-$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTATOOLS) $(SELINUX_DEPENDS)
+$(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS) $(SELINUX_DEPENDS)
 	@echo "Package: $@"
 	$(hide) ./build/tools/releasetools/img_from_target_files -v \
 	   -s $(extensions) \
diff --git a/core/java.mk b/core/java.mk
index b302c9f..4005ce3 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -3,6 +3,14 @@
 # LOCAL_MODULE_CLASS
 # all_res_assets
 
+ifeq ($(TARGET_BUILD_PDK),true)
+# LOCAL_SDK not defined or set to current
+ifeq ($(filter-out current,$(LOCAL_SDK_VERSION)),)
+LOCAL_SDK_VERSION := $(PDK_BUILD_SDK_VERSION)
+endif
+endif #PDK
+
+
 # Make sure there's something to build.
 # It's possible to build a package that doesn't contain any classes.
 ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)$(LOCAL_STATIC_JAVA_LIBRARIES)))
diff --git a/core/main.mk b/core/main.mk
index 15e8973..c22c967 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -45,7 +45,7 @@
 $(warning ********************************************************************************)
 $(warning *  You are using version $(MAKE_VERSION) of make.)
 $(warning *  Android can only be built by versions 3.81 and 3.82.)
-$(warning *  see http://source.android.com/source/download.html)
+$(warning *  see https://source.android.com/source/download.html)
 $(warning ********************************************************************************)
 $(error stopping)
 endif
@@ -131,7 +131,7 @@
 $(info The correct version is: Java SE 1.6.)
 $(info $(space))
 $(info Please follow the machine setup instructions at)
-$(info $(space)$(space)$(space)$(space)http://source.android.com/source/download.html)
+$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
 $(info ************************************************************)
 $(error stop)
 endif
@@ -147,7 +147,7 @@
 $(info The correct version is: 1.6.)
 $(info $(space))
 $(info Please follow the machine setup instructions at)
-$(info $(space)$(space)$(space)$(space)http://source.android.com/source/download.html)
+$(info $(space)$(space)$(space)$(space)https://source.android.com/source/download.html)
 $(info ************************************************************)
 $(error stop)
 endif
diff --git a/core/pdk_config.mk b/core/pdk_config.mk
index 729a44a..c0f80fd 100644
--- a/core/pdk_config.mk
+++ b/core/pdk_config.mk
@@ -64,3 +64,11 @@
 ALL_PDK_FUSION_FILES := $(addprefix $(PRODUCT_OUT)/, $(_pdk_fusion_file_list))
 
 endif
+
+ifeq ($(TARGET_BUILD_PDK),true)
+
+# SDK used for Java build under PDK
+PDK_BUILD_SDK_VERSION := $(lastword $(TARGET_AVAILABLE_SDK_VERSIONS))
+$(info PDK Build uses SDK $(PDK_BUILD_SDK_VERSION))
+
+endif # BUILD_PDK
diff --git a/target/board/vbox_x86/BoardConfig.mk b/target/board/vbox_x86/BoardConfig.mk
index c2adac3..dc0f19e 100644
--- a/target/board/vbox_x86/BoardConfig.mk
+++ b/target/board/vbox_x86/BoardConfig.mk
@@ -13,6 +13,8 @@
 TARGET_CPU_ABI := x86
 TARGET_USERIMAGES_USE_EXT4 := true
 TARGET_BOOTIMAGE_USE_EXT2 := true
+BOARD_CACHEIMAGE_PARTITION_SIZE := 268435456
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
 
 # For VirtualBox and likely other emulators
 BOARD_INSTALLER_CMDLINE := init=/init console=ttyS0 console=tty0 vga=788 verbose
diff --git a/tools/Android.mk b/tools/Android.mk
index 92603f5..fe29e2b 100644
--- a/tools/Android.mk
+++ b/tools/Android.mk
@@ -17,7 +17,7 @@
 LOCAL_PATH := $(call my-dir)
 
 # If we're building only unbundled apps, this is the only tool we need.
-ifneq ($(TARGET_BUILD_APPS),)
+ifneq (,$(TARGET_BUILD_APPS)$(filter true,$(TARGET_BUILD_PDK)))
 include $(LOCAL_PATH)/signapk/Android.mk
 else
 include $(call first-makefiles-under,$(LOCAL_PATH))
diff --git a/tools/droiddoc/templates-sdk/assets/android-developer-docs.js b/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
index c88f726..5fc7e09 100644
--- a/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
@@ -372,6 +372,7 @@
   if (sidenav.length) { // Must check if the nav exists because IE6 calls resizeWidth() from resizeAll() for all pages
     var basePath = getBaseUri(location.pathname);
     var section = basePath.substring(1,basePath.indexOf("/",1));
+    section = section.indexOf("training") != -1 ? "resources" : section;
     writeCookie("width", sidenavWidth, section, null);
   }
 }
diff --git a/tools/droiddoc/templates-sdk/customizations.cs b/tools/droiddoc/templates-sdk/customizations.cs
index 41559be..3b5f3eb 100644
--- a/tools/droiddoc/templates-sdk/customizations.cs
+++ b/tools/droiddoc/templates-sdk/customizations.cs
@@ -9,7 +9,7 @@
 <?cs /def ?>
 <?cs 
 def:resources_tab_nav() ?>
-  <div class="g-section g-tpl-200" id="body-content">
+  <div class="g-section g-tpl-240" id="body-content">
     <div class="g-unit g-first" id="side-nav" itemscope itemtype="http://schema.org/SiteNavigationElement">
       <div id="devdoc-nav"><?cs 
         include:"../../../../frameworks/base/docs/html/resources/resources_toc.cs" ?>