Merge "Append the list of languages to the list of locales"
diff --git a/buildspec.mk.default b/buildspec.mk.default
index 46aee69..2f84016 100644
--- a/buildspec.mk.default
+++ b/buildspec.mk.default
@@ -45,16 +45,9 @@
 #CUSTOM_MODULES:=
 endif
 
-# Uncomment this if you want the simulator, otherwise, build for arm
-ifndef TARGET_SIMULATOR
-#TARGET_SIMULATOR:=true
-endif
-
-# Set this to debug or release if you care.  Otherwise, it defaults to
-# release for arm and debug for the simulator.
+# Set this to debug or release if you care.  Otherwise, it defaults to release.
 ifndef TARGET_BUILD_TYPE
 #TARGET_BUILD_TYPE:=release
-#TARGET_BUILD_TYPE:=debug
 endif
 
 # Uncomment this if you want the host tools built in debug mode.  Otherwise
diff --git a/core/Makefile b/core/Makefile
index 237245b..14de987 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -16,17 +16,16 @@
 # e.g., "system/etc/file.xml".
 # The filter part means "only eval the copy-one-file rule if this
 # src:dest pair is the first one to match the same dest"
-unique_product_copy_files_destinations := $(sort \
-    $(foreach cf,$(PRODUCT_COPY_FILES), $(call word-colon,2,$(cf))))
+unique_product_copy_files_destinations :=
 $(foreach cf,$(PRODUCT_COPY_FILES), \
     $(eval _src := $(call word-colon,1,$(cf))) \
     $(eval _dest := $(call word-colon,2,$(cf))) \
-    $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \
+    $(if $(filter $(unique_product_copy_files_destinations),$(_dest)),, \
         $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \
         $(eval $(call copy-one-file,$(_src),$(_fulldest))) \
         $(eval ALL_DEFAULT_INSTALLED_MODULES += $(_fulldest)) \
-        $(eval unique_product_copy_files_destinations := $(filter-out $(_dest), \
-            $(unique_product_copy_files_destinations)))))
+        $(eval unique_product_copy_files_destinations += $(_dest))))
+unique_product_copy_files_destinations :=
 
 # -----------------------------------------------------------------
 # docs/index.html
@@ -41,9 +40,11 @@
 INSTALLED_DEFAULT_PROP_TARGET := $(TARGET_ROOT_OUT)/default.prop
 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DEFAULT_PROP_TARGET)
 ADDITIONAL_DEFAULT_PROPERTIES := \
-	$(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
+    $(call collapse-pairs, $(ADDITIONAL_DEFAULT_PROPERTIES))
 ADDITIONAL_DEFAULT_PROPERTIES += \
-	$(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+    $(call collapse-pairs, $(PRODUCT_DEFAULT_PROPERTY_OVERRIDES))
+ADDITIONAL_DEFAULT_PROPERTIES := $(call uniq-pairs-by-first-component, \
+    $(ADDITIONAL_DEFAULT_PROPERTIES),=)
 
 $(INSTALLED_DEFAULT_PROP_TARGET):
 	@echo Target buildinfo: $@
@@ -60,7 +61,9 @@
 INSTALLED_BUILD_PROP_TARGET := $(TARGET_OUT)/build.prop
 ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_BUILD_PROP_TARGET)
 ADDITIONAL_BUILD_PROPERTIES := \
-	$(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
+    $(call collapse-pairs, $(ADDITIONAL_BUILD_PROPERTIES))
+ADDITIONAL_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
+    $(ADDITIONAL_BUILD_PROPERTIES),=)
 
 # A list of arbitrary tags describing the build configuration.
 # Force ":=" so we can use +=
@@ -262,7 +265,7 @@
 DEFAULT_KEY_CERT_PAIR := $(SRC_TARGET_DIR)/product/security/testkey
 
 
-# Rules that need to be present for the simulator, even
+# Rules that need to be present for the all targets, even
 # if they don't do anything.
 .PHONY: systemimage
 systemimage:
@@ -310,8 +313,6 @@
 ALL_DEFAULT_INSTALLED_MODULES += $(event_log_tags_file)
 
 
-ifneq ($(TARGET_SIMULATOR),true)
-
 # #################################################################
 # Targets for boot/OS images
 # #################################################################
@@ -1085,7 +1086,6 @@
 target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
 
 
-ifneq ($(TARGET_SIMULATOR),true)
 ifneq ($(TARGET_PRODUCT),sdk)
 ifeq ($(filter generic%,$(TARGET_DEVICE)),)
 ifneq ($(TARGET_NO_KERNEL),true)
@@ -1146,7 +1146,6 @@
 endif    # TARGET_NO_KERNEL != true
 endif    # TARGET_DEVICE != generic*
 endif    # TARGET_PRODUCT != sdk
-endif    # TARGET_SIMULATOR != true
 
 # -----------------------------------------------------------------
 # installed file list
@@ -1266,8 +1265,6 @@
 	$(hide) find $(TARGET_COMMON_OUT_ROOT) -name "coverage.em" | \
 		zip -@ -q $@
 
-endif	# TARGET_SIMULATOR != true
-
 # -----------------------------------------------------------------
 # dalvik something
 .PHONY: dalvikfiles
@@ -1276,8 +1273,6 @@
 # -----------------------------------------------------------------
 # The emulator package
 
-ifneq ($(TARGET_SIMULATOR),true)
-
 INTERNAL_EMULATOR_PACKAGE_FILES += \
         $(HOST_OUT_EXECUTABLES)/emulator$(HOST_EXECUTABLE_SUFFIX) \
         prebuilt/android-$(TARGET_ARCH)/kernel/kernel-qemu \
@@ -1293,8 +1288,6 @@
 	@echo "Package: $@"
 	$(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES)
 
-endif
-
 # -----------------------------------------------------------------
 # The pdk package (Platform Development Kit)
 
@@ -1305,8 +1298,6 @@
 # -----------------------------------------------------------------
 # The SDK
 
-ifneq ($(TARGET_SIMULATOR),true)
-
 # The SDK includes host-specific components, so it belongs under HOST_OUT.
 sdk_dir := $(HOST_OUT)/sdk
 
@@ -1362,6 +1353,14 @@
 	$(atree_dir)/sdk-$(HOST_OS)-$(HOST_ARCH).atree \
 	$(sdk_tools_atree_files)
 
+# development/build/sdk-android-<abi>.atree is used to differentiate
+# between architecture models (e.g. ARMv5TE versus ARMv7) when copying
+# files like the kernel image. We use TARGET_CPU_ABI because we don't
+# have a better way to distinguish between CPU models.
+ifneq (,$(strip $(wildcard $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree)))
+  sdk_atree_files += $(atree_dir)/sdk-android-$(TARGET_CPU_ABI).atree
+endif
+
 deps := \
 	$(target_notice_file_txt) \
 	$(tools_notice_file_txt) \
@@ -1422,9 +1421,9 @@
 				$(PRIVATE_DIR)/platforms/android-$(PLATFORM_VERSION)/images/$(TARGET_CPU_ABI)/NOTICE.txt && \
 		cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/tools/NOTICE.txt && \
 		cp -f $(tools_notice_file_txt) $(PRIVATE_DIR)/platform-tools/NOTICE.txt && \
-		if [ -f $(PRIVATE_DIR)/platform-tools/llvm-rs-cc ]; then \
-			$(HOST_STRIP_SDK_LLVM) $(PRIVATE_DIR)/platform-tools/llvm-rs-cc; \
-		fi && \
+		for f in $(PRIVATE_DIR)/platform-tools/llvm-rs-cc-* ; do \
+			if [ -f "$$f" ]; then $(HOST_STRIP_SDK_LLVM) "$$f"; fi; \
+		done && \
 		HOST_OUT_EXECUTABLES=$(HOST_OUT_EXECUTABLES) HOST_OS=$(HOST_OS) \
 			development/build/tools/sdk_clean.sh $(PRIVATE_DIR) && \
 		chmod -R ug+rwX $(PRIVATE_DIR) && \
@@ -1441,8 +1440,6 @@
 include $(TOPDIR)development/build/tools/windows_sdk.mk
 endif
 
-endif # !simulator
-
 # -----------------------------------------------------------------
 # Findbugs
 INTERNAL_FINDBUGS_XML_TARGET := $(PRODUCT_OUT)/findbugs.xml
diff --git a/core/binary.mk b/core/binary.mk
index 61026d2..0374e93 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -9,10 +9,6 @@
 ## Sanity check for LOCAL_NDK_VERSION
 ######################################
 my_ndk_version_root :=
-ifeq ($(TARGET_SIMULATOR),true)
-  # NDK does not support sim build.
-  LOCAL_NDK_VERSION :=
-endif
 ifdef LOCAL_NDK_VERSION
   ifdef LOCAL_IS_HOST_MODULE
     $(error $(LOCAL_PATH): LOCAL_NDK_VERSION can not be used in host module)
@@ -272,7 +268,7 @@
 ## C++: Compile .cpp files to .o.
 ###########################################################
 
-# we also do this on host modules and sim builds, even though
+# we also do this on host modules, even though
 # it's not really arm, because there are files that are shared.
 cpp_arm_sources    := $(patsubst %$(LOCAL_CPP_EXTENSION).arm,%$(LOCAL_CPP_EXTENSION),$(filter %$(LOCAL_CPP_EXTENSION).arm,$(LOCAL_SRC_FILES)))
 cpp_arm_objects    := $(addprefix $(intermediates)/,$(cpp_arm_sources:$(LOCAL_CPP_EXTENSION)=.o))
diff --git a/core/build-system.html b/core/build-system.html
index e547185..760589a 100644
--- a/core/build-system.html
+++ b/core/build-system.html
@@ -516,16 +516,8 @@
 </tr>
 </table>
 
-<h4>TARGET_SIMULATOR</h4>
-<p>If we're building the simulator, as opposed to the arm or emulator builds,
-<code>TARGET_SIMULATOR</code> will be set to <code>true</code>.
-
 <h4>Some Examples</h4>
-<pre>ifeq ($(TARGET_SIMULATOR),true)
-LOCAL_CFLAGS += -DSIMULATOR
-endif
-
-ifeq ($(TARGET_BUILD_TYPE),release)
+<pre>ifeq ($(TARGET_BUILD_TYPE),release)
 LOCAL_CFLAGS += -DNDEBUG=1
 endif
 
diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk
index c871613..5ae4972 100644
--- a/core/combo/HOST_linux-x86.mk
+++ b/core/combo/HOST_linux-x86.mk
@@ -45,13 +45,8 @@
 # We build everything in 32-bit, because some host tools are
 # 32-bit-only anyway (emulator, acc), and because it gives us
 # more consistency between the host tools and the target.
-# The exception is the host side of the simulator, which
-# requires to use the default size, as wxWidgets code otherwise
-# fails to build.
-ifneq ($(TARGET_SIMULATOR),true)
 HOST_GLOBAL_CFLAGS += -m32
 HOST_GLOBAL_LDFLAGS += -m32
-endif
 
 HOST_GLOBAL_CFLAGS += -fPIC
 HOST_GLOBAL_CFLAGS += \
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index 6db0795..9748187 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -47,13 +47,22 @@
 	prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-
 endif
 
-TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
-TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
-TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
-TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
-TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
-TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@
+# Only define these if there's actually a gcc in there.
+# The gcc toolchain does not exists for windows/cygwin. In this case, do not reference it.
+ifneq ($(wildcard $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)),)
+    TARGET_CC := $(TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_CXX := $(TARGET_TOOLS_PREFIX)g++$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_AR := $(TARGET_TOOLS_PREFIX)ar$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
+    TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+    ifeq ($(TARGET_BUILD_VARIANT),user)
+        TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@
+    else
+        TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-all $< -o $@ && \
+	    $(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+    endif
+endif
 
 TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
 
diff --git a/core/combo/TARGET_linux-sh.mk b/core/combo/TARGET_linux-sh.mk
index f54a49e..b8e00dd 100644
--- a/core/combo/TARGET_linux-sh.mk
+++ b/core/combo/TARGET_linux-sh.mk
@@ -29,7 +29,13 @@
 TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
 TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
 TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
 TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@
+else
+TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@ && \
+	$(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+endif
 
 TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
 
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index d8056e3..0d05dd2 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -17,19 +17,6 @@
 # Configuration for Linux on x86 as a target.
 # Included by combo/select.mk
 
-ifeq ($(TARGET_SIMULATOR),true)
-# When building for the simulator, use the HOST settings as TARGET settings
-TARGET_CC := $(HOST_CC)
-TARGET_CXX := $(HOST_CXX)
-TARGET_AR := $(HOST_AR)
-TARGET_GLOBAL_CFLAGS := $(HOST_GLOBAL_CFLAGS) -m32
-TARGET_GLOBAL_LDFLAGS := $(HOST_GLOBAL_LDFLAGS) -m32 -lpthread
-TARGET_NO_UNDEFINED_LDFLAGS := $(HOST_NO_UNDEFINED_LDFLAGS)
-ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
-TARGET_ARCH_VARIANT := x86
-endif
-else #simulator
-
 # Provide a default variant.
 ifeq ($(strip $(TARGET_ARCH_VARIANT)),)
 TARGET_ARCH_VARIANT := x86
@@ -47,7 +34,13 @@
 TARGET_OBJCOPY := $(TARGET_TOOLS_PREFIX)objcopy$(HOST_EXECUTABLE_SUFFIX)
 TARGET_LD := $(TARGET_TOOLS_PREFIX)ld$(HOST_EXECUTABLE_SUFFIX)
 TARGET_STRIP := $(TARGET_TOOLS_PREFIX)strip$(HOST_EXECUTABLE_SUFFIX)
+
+ifeq ($(TARGET_BUILD_VARIANT),user)
 TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@
+else
+TARGET_STRIP_COMMAND = $(TARGET_STRIP) --strip-debug $< -o $@ && \
+	$(TARGET_OBJCOPY) --add-gnu-debuglink=$< $@
+endif
 
 ifneq ($(wildcard $(TARGET_CC)),)
 TARGET_LIBGCC := \
@@ -198,5 +191,3 @@
 	-Wl,--end-group \
 	$(if $(filter true,$(PRIVATE_NO_CRT)),,$(TARGET_CRTEND_O))
 endef
-
-endif #simulator
diff --git a/core/config.mk b/core/config.mk
index 82238e9..0951777 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -102,6 +102,11 @@
 # list of flags to turn specific warnings in to errors
 TARGET_ERROR_FLAGS := -Werror=return-type -Werror=non-virtual-dtor -Werror=address -Werror=sequence-point
 
+# Temporarily turn off Wunsed-but-set-variables warning in gcc-4.6
+# since this warning becomes an error in dalvik, core and renderscript.
+# This is ignored by gcc-4.4.x.
+TARGET_ERROR_FLAGS += -Wno-unused-but-set-variable
+
 # TODO: do symbol compression
 TARGET_COMPRESS_MODULE_SYMBOLS := false
 
@@ -312,13 +317,9 @@
 
 # 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
-# the source tree. The simulator passes the target flags to the
-# host compiler, so only set them for the target when the target
-# is not the simulator.
-ifneq ($(TARGET_SIMULATOR),true)
+# the source tree.
 TARGET_GLOBAL_CFLAGS += $(TARGET_ERROR_FLAGS)
 TARGET_GLOBAL_CPPFLAGS += $(TARGET_ERROR_FLAGS)
-endif
 
 HOST_GLOBAL_CFLAGS += $(HOST_RELEASE_CFLAGS)
 HOST_GLOBAL_CPPFLAGS += $(HOST_RELEASE_CPPFLAGS)
@@ -364,10 +365,6 @@
 
 # This is the standard way to name a directory containing prebuilt target
 # objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
-ifeq ($(TARGET_SIMULATOR),true)
-  TARGET_PREBUILT_TAG := $(TARGET_OS)-$(TARGET_ARCH)
-else
-  TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
-endif
+TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
 
 include $(BUILD_SYSTEM)/dumpvar.mk
diff --git a/core/definitions.mk b/core/definitions.mk
index 9251017..4c499ad 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -600,6 +600,21 @@
 endef
 
 ###########################################################
+## Given a list of pairs, if multiple pairs have the same
+## first components, keep only the first pair.
+##
+## $(1): list of pairs
+## $(2): the separator word, such as ":", "=", etc.
+define uniq-pairs-by-first-component
+$(eval _upbfc_fc_set :=)\
+$(strip $(foreach w,$(1), $(eval _first := $(word 1,$(subst $(2),$(space),$(w))))\
+    $(if $(filter $(_upbfc_fc_set),$(_first)),,$(w)\
+        $(eval _upbfc_fc_set += $(_first)))))\
+$(eval _upbfc_fc_set :=)\
+$(eval _first:=)
+endef
+
+###########################################################
 ## MODULE_TAG set operations
 ###########################################################
 
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index c94d943..e0de464 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -5,9 +5,8 @@
 
 ABP:=$(PWD)/$(HOST_OUT_EXECUTABLES)
 
-ifeq ($(TARGET_SIMULATOR),true)
-	ABP:=$(ABP):$(TARGET_OUT_EXECUTABLES)
-else
+# Add the toolchain bin dir if it actually exists
+ifneq ($(wildcard $(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/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
 endif
@@ -65,7 +64,6 @@
 $(info   PLATFORM_VERSION=$(PLATFORM_VERSION))
 $(info   TARGET_PRODUCT=$(TARGET_PRODUCT))
 $(info   TARGET_BUILD_VARIANT=$(TARGET_BUILD_VARIANT))
-$(info   TARGET_SIMULATOR=$(TARGET_SIMULATOR))
 $(info   TARGET_BUILD_TYPE=$(TARGET_BUILD_TYPE))
 $(info   TARGET_BUILD_APPS=$(TARGET_BUILD_APPS))
 $(info   TARGET_ARCH=$(TARGET_ARCH))
diff --git a/core/envsetup.mk b/core/envsetup.mk
index b02d8c6..016560a 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -1,6 +1,5 @@
 # Variables we check:
 #     HOST_BUILD_TYPE = { release debug }
-#     TARGET_SIMULATOR = { true <null> }
 #     TARGET_BUILD_TYPE = { release debug }
 # and we output a bunch of variables, see the case statement at
 # the bottom for the full list
@@ -19,16 +18,12 @@
 CORRECT_BUILD_ENV_SEQUENCE_NUMBER := 10
 
 # ---------------------------------------------------------------
-# The product defaults to generic on hardware and sim on sim
+# The product defaults to generic on hardware
 # NOTE: This will be overridden in product_config.mk if make
 # was invoked with a PRODUCT-xxx-yyy goal.
 ifeq ($(TARGET_PRODUCT),)
-ifeq ($(TARGET_SIMULATOR),true)
-TARGET_PRODUCT := sim
-else
 TARGET_PRODUCT := full
 endif
-endif
 
 
 # the variant -- the set of files that are included for a build
@@ -124,20 +119,10 @@
 # 		TARGET_ARCH = { arm | x86 }
 
 
-# if we're build the simulator, HOST_* is TARGET_* (except for BUILD_TYPE)
-# otherwise  it's <arch>-linux
-ifeq ($(TARGET_SIMULATOR),true)
-ifneq ($(HOST_OS),linux)
-$(error TARGET_SIMULATOR=true is only supported under Linux)
-endif
-TARGET_ARCH := $(HOST_ARCH)
-TARGET_OS := $(HOST_OS)
-else
 ifeq ($(TARGET_ARCH),)
 TARGET_ARCH := arm
 endif
 TARGET_OS := linux
-endif
 
 # the target build type defaults to release
 ifneq ($(TARGET_BUILD_TYPE),debug)
@@ -169,15 +154,7 @@
 
 BUILD_OUT := $(OUT_DIR)/host/$(BUILD_OS)-$(BUILD_ARCH)
 
-ifeq ($(TARGET_SIMULATOR),true)
-  # Any arch- or os-specific parts of the simulator (everything
-  # under product/) are actually host-dependent.
-  # But, the debug type is controlled by TARGET_BUILD_TYPE and not
-  # HOST_BUILD_TYPE.
-  TARGET_PRODUCT_OUT_ROOT := $(HOST_OUT_$(TARGET_BUILD_TYPE))/pr
-else
-  TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
-endif
+TARGET_PRODUCT_OUT_ROOT := $(TARGET_OUT_ROOT)/product
 
 TARGET_COMMON_OUT_ROOT := $(TARGET_OUT_ROOT)/common
 HOST_COMMON_OUT_ROOT := $(HOST_OUT_ROOT)/common
diff --git a/core/host_native_test.mk b/core/host_native_test.mk
index 2a77f1e..a5d87e4 100644
--- a/core/host_native_test.mk
+++ b/core/host_native_test.mk
@@ -5,10 +5,9 @@
 
 LOCAL_CFLAGS += -DGTEST_OS_LINUX -DGTEST_HAS_STD_STRING -O0 -g
 LOCAL_C_INCLUDES +=  \
-                    bionic/libstdc++/include \
-                    external/gtest/include \
-                    external/astl/include
-LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host libastl_host
+    external/gtest/include
+
+LOCAL_STATIC_LIBRARIES += libgtest_host libgtest_main_host
 LOCAL_SHARED_LIBRARIES +=
 
 include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/main.mk b/core/main.mk
index f918dfd..959cd83 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -12,6 +12,13 @@
 # this turns off the suffix rules built into make
 .SUFFIXES:
 
+# this turns off the RCS / SCCS implicit rules of GNU Make
+% : RCS/%,v
+% : RCS/%
+% : %,v
+% : s.%
+% : SCCS/s.%
+
 # If a rule fails, delete $@.
 .DELETE_ON_ERROR:
 
@@ -249,12 +256,12 @@
 
 ifeq (true,$(strip $(enable_target_debugging)))
   # Target is more debuggable and adbd is on by default
-  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1 persist.service.adb.enable=1
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=1
   # Include the debugging/testing OTA keys in this build.
   INCLUDE_TEST_OTA_KEYS := true
 else # !enable_target_debugging
   # Target is less debuggable and adbd is off by default
-  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0 persist.service.adb.enable=0
+  ADDITIONAL_DEFAULT_PROPERTIES += ro.debuggable=0
 endif # !enable_target_debugging
 
 ## eng ##
@@ -448,7 +455,7 @@
 else	# !SDK_ONLY
 ifeq ($(BUILD_TINY_ANDROID), true)
 
-# TINY_ANDROID is a super-minimal build configuration, handy for board 
+# TINY_ANDROID is a super-minimal build configuration, handy for board
 # bringup and very low level debugging
 
 subdirs := \
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 78dee49..6c6ff2e 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -88,7 +88,6 @@
 	    sax \
 	    telephony \
 	    wifi \
-	    vpn \
 	    keystore \
 	    icu4j \
 	    voip \
diff --git a/core/prebuilt.mk b/core/prebuilt.mk
index 8f9eafb..07ecf64 100644
--- a/core/prebuilt.mk
+++ b/core/prebuilt.mk
@@ -26,7 +26,22 @@
 endif
 endif
 
-include $(BUILD_SYSTEM)/base_rules.mk
+ifeq ($(LOCAL_STRIP_MODULE),true)
+  ifdef LOCAL_IS_HOST_MODULE
+    $(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
+  endif
+  ifeq ($(filter SHARED_LIBRARIES EXECUTABLES,$(LOCAL_MODULE_CLASS)),)
+    $(error Can strip only shared libraries or executables LOCAL_PATH=$(LOCAL_PATH))
+  endif
+  ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
+    $(error Cannot strip scripts LOCAL_PATH=$(LOCAL_PATH))
+  endif
+  include $(BUILD_SYSTEM)/dynamic_binary.mk
+  built_module := $(linked_module)
+else
+  include $(BUILD_SYSTEM)/base_rules.mk
+  built_module := $(LOCAL_BUILT_MODULE)
+endif
 
 # Deal with the OSX library timestamp issue when installing
 # a prebuilt simulator library.
@@ -42,24 +57,24 @@
 ifneq ($(filter APPS,$(LOCAL_MODULE_CLASS)),)
 ifeq ($(LOCAL_DEX_PREOPT),true)
 # Make sure the boot jars get dexpreopt-ed first
-$(LOCAL_BUILT_MODULE): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT)
+$(built_module): $(DEXPREOPT_BOOT_ODEXS) | $(DEXPREOPT) $(DEXOPT) $(AAPT)
 endif
-$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
+$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ZIPALIGN)
 	$(transform-prebuilt-to-target-with-zipalign)
 ifeq ($(LOCAL_DEX_PREOPT),true)
 	$(hide) rm -f $(patsubst %.apk,%.odex,$@)
 	$(call dexpreopt-one-file,$@,$(patsubst %.apk,%.odex,$@))
 	$(call dexpreopt-remove-classes.dex,$@)
 
-built_odex := $(basename $(LOCAL_BUILT_MODULE)).odex
-$(built_odex): $(LOCAL_BUILT_MODULE)
+built_odex := $(basename $(built_module)).odex
+$(built_odex): $(built_module)
 endif
 else
 ifneq ($(LOCAL_PREBUILT_STRIP_COMMENTS),)
-$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
+$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
 	$(transform-prebuilt-to-target-strip-comments)
 else
-$(LOCAL_BUILT_MODULE) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
+$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
 	$(transform-prebuilt-to-target)
 endif
 endif
@@ -79,7 +94,7 @@
 	$(transform-prebuilt-to-target)
 
 # make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
-$(LOCAL_BUILT_MODULE) : $(common_javalib_jar)
+$(built_module) : $(common_javalib_jar)
 endif # TARGET JAVA_LIBRARIES
 
 ifeq ($(LOCAL_CERTIFICATE),EXTERNAL)
diff --git a/core/product_config.mk b/core/product_config.mk
index d766ba7..1567f6d 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -163,26 +163,13 @@
 $(unbundled_goals): $(MAKECMDGOALS)
 endif # unbundled_goals
 
-# ---------------------------------------------------------------
-# Simulator overrides
-ifeq ($(TARGET_PRODUCT),sim)
-  # Tell the build system to turn on some special cases
-  # to deal with the simulator product.
-  TARGET_SIMULATOR := true
-  # dexpreopt doesn't work when building the simulator
-  DISABLE_DEXPREOPT := true
-endif
-
 # Default to building dalvikvm on hosts that support it...
 ifeq ($(HOST_OS),linux)
-# ... but not if we're building the sim...
-ifneq ($(TARGET_SIMULATOR),true)
 # ... or if the if the option is already set
 ifeq ($(WITH_HOST_DALVIK),)
   WITH_HOST_DALVIK := true
 endif
 endif
-endif
 
 # ---------------------------------------------------------------
 # Include the product definitions.
diff --git a/core/user_tags.mk b/core/user_tags.mk
index d30e86b..6b77bec 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -476,7 +476,6 @@
 	signapk \
 	signature-tools \
 	simg2img \
-	simulator \
 	spec-progress \
 	sqlite3 \
 	stack_dump \
diff --git a/envsetup.sh b/envsetup.sh
index 8b36bba..305866e 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -54,8 +54,9 @@
         return
     fi
     CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \
-        TARGET_PRODUCT=$1 TARGET_BUILD_VARIANT= \
-        TARGET_SIMULATOR= TARGET_BUILD_TYPE= \
+        TARGET_PRODUCT=$1 \
+        TARGET_BUILD_VARIANT= \
+        TARGET_BUILD_TYPE= \
         TARGET_BUILD_APPS= \
         get_build_var TARGET_DEVICE > /dev/null
     # hide successful answers, but allow the errors to show
@@ -95,11 +96,14 @@
     #                                                                #
     ##################################################################
 
+    # Note: on windows/cygwin, ANDROID_BUILD_PATHS will contain spaces
+    # due to "C:\Program Files" being in the path.
+
     # out with the old
-    if [ -n $ANDROID_BUILD_PATHS ] ; then
+    if [ -n "$ANDROID_BUILD_PATHS" ] ; then
         export PATH=${PATH/$ANDROID_BUILD_PATHS/}
     fi
-    if [ -n $ANDROID_PRE_BUILD_PATHS ] ; then
+    if [ -n "$ANDROID_PRE_BUILD_PATHS" ] ; then
         export PATH=${PATH/$ANDROID_PRE_BUILD_PATHS/}
         # strip trailing ':', if any
         export PATH=${PATH/%:/}
@@ -108,20 +112,31 @@
     # and in with the new
     CODE_REVIEWS=
     prebuiltdir=$(getprebuilt)
-    export ANDROID_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-linux-androideabi-4.4.x/bin
-    export ARM_EABI_TOOLCHAIN=$prebuiltdir/toolchain/arm-eabi-4.4.3/bin
+
+    # 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
+    fi
+
+    export ARM_EABI_TOOLCHAIN=
+    toolchaindir=toolchain/arm-eabi-4.4.3/bin
+    if [ -d "$prebuiltdir/$toolchaindir" ]; then
+        export ARM_EABI_TOOLCHAIN=$prebuiltdir/$toolchaindir
+    fi
+
     export ANDROID_TOOLCHAIN=$ANDROID_EABI_TOOLCHAIN
     export ANDROID_QTOOLS=$T/development/emulator/qtools
     export ANDROID_BUILD_PATHS=:$(get_build_var ANDROID_BUILD_PATHS):$ANDROID_QTOOLS:$ANDROID_TOOLCHAIN:$ARM_EABI_TOOLCHAIN$CODE_REVIEWS
     export PATH=$PATH$ANDROID_BUILD_PATHS
 
     unset ANDROID_JAVA_TOOLCHAIN
+    unset ANDROID_PRE_BUILD_PATHS
     if [ -n "$JAVA_HOME" ]; then
         export ANDROID_JAVA_TOOLCHAIN=$JAVA_HOME/bin
-    fi
-    export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN
-    if [ -n "$ANDROID_PRE_BUILD_PATHS" ]; then
-        export PATH=$ANDROID_PRE_BUILD_PATHS:$PATH
+        export ANDROID_PRE_BUILD_PATHS=$ANDROID_JAVA_TOOLCHAIN:
+        export PATH=$ANDROID_PRE_BUILD_PATHS$PATH
     fi
 
     unset ANDROID_PRODUCT_OUT
@@ -175,74 +190,6 @@
     fi
 }
 
-case `uname -s` in
-    Linux)
-        function choosesim()
-        {
-            echo "Build for the simulator or the device?"
-            echo "     1. Device"
-            echo "     2. Simulator"
-            echo
-
-            export TARGET_SIMULATOR=
-            local ANSWER
-            while [ -z $TARGET_SIMULATOR ]
-            do
-                echo -n "Which would you like? [1] "
-                if [ -z "$1" ] ; then
-                    read ANSWER
-                else
-                    echo $1
-                    ANSWER=$1
-                fi
-                case $ANSWER in
-                "")
-                    export TARGET_SIMULATOR=false
-                    ;;
-                1)
-                    export TARGET_SIMULATOR=false
-                    ;;
-                Device)
-                    export TARGET_SIMULATOR=false
-                    ;;
-                2)
-                    export TARGET_SIMULATOR=true
-                    ;;
-                Simulator)
-                    export TARGET_SIMULATOR=true
-                    ;;
-                *)
-                    echo
-                    echo "I didn't understand your response.  Please try again."
-                    echo
-                    ;;
-                esac
-                if [ -n "$1" ] ; then
-                    break
-                fi
-            done
-
-            set_stuff_for_environment
-        }
-        ;;
-    *)
-        function choosesim()
-        {
-            echo "Only device builds are supported for" `uname -s`
-            echo "     Forcing TARGET_SIMULATOR=false"
-            echo
-            if [ -z "$1" ]
-            then
-                echo -n "Press enter: "
-                read
-            fi
-
-            export TARGET_SIMULATOR=false
-            set_stuff_for_environment
-        }
-        ;;
-esac
-
 function choosetype()
 {
     echo "Build type choices are:"
@@ -251,13 +198,8 @@
     echo
 
     local DEFAULT_NUM DEFAULT_VALUE
-    if [ $TARGET_SIMULATOR = "false" ] ; then
-        DEFAULT_NUM=1
-        DEFAULT_VALUE=release
-    else
-        DEFAULT_NUM=2
-        DEFAULT_VALUE=debug
-    fi
+    DEFAULT_NUM=1
+    DEFAULT_VALUE=release
 
     export TARGET_BUILD_TYPE=
     local ANSWER
@@ -311,11 +253,7 @@
     if [ "x$TARGET_PRODUCT" != x ] ; then
         default_value=$TARGET_PRODUCT
     else
-        if [ "$TARGET_SIMULATOR" = true ] ; then
-            default_value=sim
-        else
-            default_value=full
-        fi
+        default_value=full
     fi
 
     export TARGET_PRODUCT=
@@ -397,19 +335,15 @@
 
 function choosecombo()
 {
-    choosesim $1
+    choosetype $1
 
     echo
     echo
-    choosetype $2
+    chooseproduct $2
 
     echo
     echo
-    chooseproduct $3
-
-    echo
-    echo
-    choosevariant $4
+    choosevariant $3
 
     echo
     set_stuff_for_environment
@@ -472,9 +406,6 @@
     if [ -z "$answer" ]
     then
         selection=full-eng
-    elif [ "$answer" = "simulator" ]
-    then
-        selection=simulator
     elif (echo -n $answer | grep -q -e "^[0-9][0-9]*$")
     then
         if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
@@ -495,45 +426,35 @@
 
     export TARGET_BUILD_APPS=
 
-    # special case the simulator
-    if [ "$selection" = "simulator" ]
+    local product=$(echo -n $selection | sed -e "s/-.*$//")
+    check_product $product
+    if [ $? -ne 0 ]
     then
-        export TARGET_PRODUCT=sim
-        export TARGET_BUILD_VARIANT=eng
-        export TARGET_SIMULATOR=true
-        export TARGET_BUILD_TYPE=debug
-    else
-        local product=$(echo -n $selection | sed -e "s/-.*$//")
-        check_product $product
-        if [ $? -ne 0 ]
-        then
-            echo
-            echo "** Don't have a product spec for: '$product'"
-            echo "** Do you have the right repo manifest?"
-            product=
-        fi
+        echo
+        echo "** Don't have a product spec for: '$product'"
+        echo "** Do you have the right repo manifest?"
+        product=
+    fi
 
-        local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
-        check_variant $variant
-        if [ $? -ne 0 ]
-        then
-            echo
-            echo "** Invalid variant: '$variant'"
-            echo "** Must be one of ${VARIANT_CHOICES[@]}"
-            variant=
-        fi
+    local variant=$(echo -n $selection | sed -e "s/^[^\-]*-//")
+    check_variant $variant
+    if [ $? -ne 0 ]
+    then
+        echo
+        echo "** Invalid variant: '$variant'"
+        echo "** Must be one of ${VARIANT_CHOICES[@]}"
+        variant=
+    fi
 
-        if [ -z "$product" -o -z "$variant" ]
-        then
-            echo
-            return 1
-        fi
+    if [ -z "$product" -o -z "$variant" ]
+    then
+        echo
+        return 1
+    fi
 
-        export TARGET_PRODUCT=$product
-        export TARGET_BUILD_VARIANT=$variant
-        export TARGET_SIMULATOR=false
-        export TARGET_BUILD_TYPE=release
-    fi # !simulator
+    export TARGET_PRODUCT=$product
+    export TARGET_BUILD_VARIANT=$variant
+    export TARGET_BUILD_TYPE=release
 
     echo
 
@@ -574,7 +495,6 @@
 
     export TARGET_PRODUCT=full
     export TARGET_BUILD_VARIANT=$variant
-    export TARGET_SIMULATOR=false
     export TARGET_BUILD_TYPE=release
     export TARGET_BUILD_APPS=$apps
 
@@ -1109,13 +1029,15 @@
     fi
 }
 
-case `ps -o command -p $$` in
-    *bash*)
-        ;;
-    *)
-        echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
-        ;;
-esac
+if [ "x$SHELL" != "x/bin/bash" ]; then
+    case `ps -o command -p $$` in
+        *bash*)
+            ;;
+        *)
+            echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
+            ;;
+    esac
+fi
 
 # Execute the contents of any vendorsetup.sh files we can find.
 for f in `/bin/ls vendor/*/vendorsetup.sh vendor/*/*/vendorsetup.sh device/*/*/vendorsetup.sh 2> /dev/null`
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 2b05f79..d02205b 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -6,7 +6,22 @@
 # The generic product target doesn't have any hardware-specific pieces.
 TARGET_NO_BOOTLOADER := true
 TARGET_NO_KERNEL := true
-TARGET_CPU_ABI := armeabi
+
+# Note: we build the platform images for ARMv7-A _without_ NEON.
+#
+# Technically, the emulator supports ARMv7-A _and_ NEON instructions, but
+# emulated NEON code paths typically ends up 2x slower than the normal C code
+# it is supposed to replace (unlike on real devices where it is 2x to 3x
+# faster).
+#
+# What this means is that the platform image will not use NEON code paths
+# that are slower to emulate. On the other hand, it is possible to emulate
+# application code generated with the NDK that uses NEON in the emulator.
+#
+TARGET_ARCH_VARIANT := armv7-a
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+
 HAVE_HTC_AUDIO_DRIVER := true
 BOARD_USES_GENERIC_AUDIO := true
 
diff --git a/target/board/sim/AndroidBoard.mk b/target/board/sim/AndroidBoard.mk
deleted file mode 100644
index e69de29..0000000
--- a/target/board/sim/AndroidBoard.mk
+++ /dev/null
diff --git a/target/board/sim/BoardConfig.mk b/target/board/sim/BoardConfig.mk
deleted file mode 100644
index ba55b92..0000000
--- a/target/board/sim/BoardConfig.mk
+++ /dev/null
@@ -1,29 +0,0 @@
-# config.mk
-# 
-# Product-specific compile-time definitions.
-#
-
-# Don't try compressing the shared libraries used by the simulator.  The host
-# OS won't know what to do with them, and they may not even be ELF files.
-#
-# These definitions override the defaults in config/config.make.
-TARGET_COMPRESS_MODULE_SYMBOLS := false
-
-# Don't try to build a bootloader.
-TARGET_NO_BOOTLOADER := true
-
-# Don't bother with a kernel
-TARGET_NO_KERNEL := true
-
-# The simulator does not support native code at all
-TARGET_CPU_ABI := none
-
-# But it is very likely SMP.
-TARGET_CPU_SMP := true
-
-#the simulator partially emulates the original HTC /dev/eac audio interface
-HAVE_HTC_AUDIO_DRIVER := true
-BOARD_USES_GENERIC_AUDIO := true
-
-# no hardware camera
-USE_CAMERA_STUB := true
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index fafd222..44b9000 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -41,6 +41,5 @@
     $(LOCAL_DIR)/vbox_x86.mk \
     $(LOCAL_DIR)/sdk.mk \
     $(LOCAL_DIR)/sdk_x86.mk \
-    $(LOCAL_DIR)/sim.mk \
     $(LOCAL_DIR)/large_emu_hw.mk
 endif
diff --git a/target/product/core.mk b/target/product/core.mk
index 6c8e21f..caa3e381 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -26,6 +26,7 @@
     apache-xml \
     bouncycastle \
     bu \
+    bluetooth-health \
     cacerts \
     com.android.location.provider \
     com.android.location.provider.xml \
@@ -39,6 +40,7 @@
     dmtracedump \
     dx \
     ext \
+    filterfw \
     framework-res \
     hprof-conv \
     icu.dat \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index 8ad812e..a8a32fe 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -25,10 +25,12 @@
     libdrmframework_jni \
     libfwdlockengine \
     OpenWnn \
+    PhotoEditor \
     PinyinIME \
     libWnnEngDic \
     libWnnJpnDic \
     libwnndict \
+    VideoEditor \
     WAPPushManager
 
 # Additional settings used in all AOSP builds
diff --git a/target/product/languages_full.mk b/target/product/languages_full.mk
index 236dfa2..b18f78f 100644
--- a/target/product/languages_full.mk
+++ b/target/product/languages_full.mk
@@ -21,7 +21,5 @@
 
 # Those are all the locales that have translations and are displayable
 # by TextView in this branch.
-PRODUCT_LOCALES := en_US fr_FR it_IT es_ES de_DE nl_NL cs_CZ pl_PL ja_JP zh_TW zh_CN ru_RU ko_KR nb_NO es_US da_DK el_GR tr_TR pt_PT pt_BR rm_CH sv_SE bg_BG ca_ES en_GB fi_FI hr_HR hu_HU in_ID iw_IL lt_LT lv_LV ro_RO sk_SK sl_SI sr_RS uk_UA vi_VN tl_PH
-
-# Not currently usable:
-# ar, fa, th
+PRODUCT_LOCALES := en_US fr_FR it_IT es_ES de_DE nl_NL cs_CZ pl_PL ja_JP zh_TW zh_CN ru_RU ko_KR nb_NO es_US da_DK el_GR tr_TR pt_PT pt_BR rm_CH sv_SE bg_BG ca_ES en_GB fi_FI hr_HR hu_HU in_ID iw_IL lt_LT lv_LV ro_RO sk_SK sl_SI sr_RS uk_UA vi_VN tl_PH ar_EG fa_IR th_TH sw_TZ ms_MY af_ZA zu_ZA
+# We don't have the fonts to display am_ET yet
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 92de1b2..7e470b9 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -121,7 +121,8 @@
 	ninepatch-tests \
 	common-tests \
 	sdklib-tests \
-	sdkuilib-tests
+	sdkuilib-tests \
+	layoutlib-tests
 
 PRODUCT_PACKAGE_OVERLAYS := development/sdk_overlay
 
diff --git a/target/product/sim.mk b/target/product/sim.mk
deleted file mode 100644
index 09722d6..0000000
--- a/target/product/sim.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/locales_full.mk)
-
-# Overrides
-PRODUCT_NAME := sim
-PRODUCT_DEVICE := sim
diff --git a/tools/check_prereq/Android.mk b/tools/check_prereq/Android.mk
index abedff6..4329aff 100644
--- a/tools/check_prereq/Android.mk
+++ b/tools/check_prereq/Android.mk
@@ -15,8 +15,6 @@
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
-ifneq ($(TARGET_SIMULATOR),true)
-
 LOCAL_SRC_FILES := check_prereq.c
 LOCAL_MODULE := check_prereq
 LOCAL_FORCE_STATIC_EXECUTABLE := true
@@ -25,6 +23,3 @@
 LOCAL_STATIC_LIBRARIES += libcutils libc
 
 include $(BUILD_EXECUTABLE)
-
-endif  # !TARGET_SIMULATOR
-
diff --git a/tools/droiddoc/templates-sdk/assets/android-developer-docs.js b/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
index 728e015..e353236 100644
--- a/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
+++ b/tools/droiddoc/templates-sdk/assets/android-developer-docs.js
@@ -255,23 +255,23 @@
   if (lastSlashPos == (fullPageName.length - 1)) { // if the url ends in slash (add 'index.html')
     fullPageName = fullPageName + "index.html";
   }
-  // First check if the exact URL, with query string and all, is in the navigation menu
-  var pathPageName = fullPageName.substr(firstSlashPos);
+
+  // get the path and page name from the URL (such as 'guide/topics/graphics/index.html')
+  var htmlPos = fullPageName.indexOf(".html");
+  var pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5); // +5 advances past ".html"
+  // find instances of the page name in the side nav
   var link = $("#devdoc-nav a[href$='"+ pathPageName+"']");
-  if (link.length == 0) {
-    var htmlPos = fullPageName.lastIndexOf(".html", fullPageName.length);
-    pathPageName = fullPageName.slice(firstSlashPos, htmlPos + 5); // +5 advances past ".html"
-    link = $("#devdoc-nav a[href$='"+ pathPageName+"']");
-    if ((link.length == 0) && ((fullPageName.indexOf("/guide/") != -1) || (fullPageName.indexOf("/resources/") != -1))) {
-      // if there's no match, then let's backstep through the directory until we find an index.html page
-      // that matches our ancestor directories (only for dev guide and resources)
-      lastBackstep = pathPageName.lastIndexOf("/");
-      while (link.length == 0) {
-        backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep);
-        link = $("#devdoc-nav a[href$='"+ pathPageName.slice(0, backstepDirectory + 1)+"index.html']");
-        lastBackstep = pathPageName.lastIndexOf("/", lastBackstep - 1);
-        if (lastBackstep == 0) break;
-      }
+  // if there's no match, then let's backstep through the directory until we find an index.html
+  // page that matches our ancestor directories (only for dev guide and resources)
+  if ((link.length == 0) && ((fullPageName.indexOf("/guide/") != -1) ||
+                  (fullPageName.indexOf("/resources/") != -1))) {
+    lastBackstep = pathPageName.lastIndexOf("/");
+    while (link.length == 0) {
+      backstepDirectory = pathPageName.lastIndexOf("/", lastBackstep);
+      link = $("#devdoc-nav a[href$='"+ pathPageName.slice(0, backstepDirectory +
+                      1)+"index.html']");
+      lastBackstep = pathPageName.lastIndexOf("/", lastBackstep - 1);
+      if (lastBackstep == 0) break;
     }
   }
 
diff --git a/tools/droiddoc/templates-sdk/assets/images/home/GTV_icon_large.png b/tools/droiddoc/templates-sdk/assets/images/home/GTV_icon_large.png
new file mode 100644
index 0000000..72d54ad
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/home/GTV_icon_large.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/home/GTV_icon_small.png b/tools/droiddoc/templates-sdk/assets/images/home/GTV_icon_small.png
new file mode 100644
index 0000000..3da1699
--- /dev/null
+++ b/tools/droiddoc/templates-sdk/assets/images/home/GTV_icon_small.png
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/home/tv_l.png b/tools/droiddoc/templates-sdk/assets/images/home/tv_l.png
deleted file mode 100644
index ed89bfc..0000000
--- a/tools/droiddoc/templates-sdk/assets/images/home/tv_l.png
+++ /dev/null
Binary files differ
diff --git a/tools/droiddoc/templates-sdk/assets/images/home/tv_s.png b/tools/droiddoc/templates-sdk/assets/images/home/tv_s.png
deleted file mode 100644
index 6ca68cb..0000000
--- a/tools/droiddoc/templates-sdk/assets/images/home/tv_s.png
+++ /dev/null
Binary files differ
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index 3f2ed95..5486bc2 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -15,13 +15,9 @@
 LOCAL_PATH := $(call my-dir)
 include $(CLEAR_VARS)
 
-ifneq ($(TARGET_SIMULATOR),true)
-
 LOCAL_SRC_FILES := fs_config.c
 LOCAL_MODULE := fs_config
 LOCAL_FORCE_STATIC_EXECUTABLE := true
 LOCAL_MODULE_TAGS := eng
 
 include $(BUILD_HOST_EXECUTABLE)
-
-endif  # !TARGET_SIMULATOR