Merge branch 'master' into honeycomb-release
diff --git a/core/Makefile b/core/Makefile
index 1e49bd1..237c8de 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -73,7 +73,7 @@
 
 # The string used to uniquely identify this build;  used by the OTA server.
 ifeq (,$(strip $(BUILD_FINGERPRINT)))
-  BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE)/$(TARGET_BOOTLOADER_BOARD_NAME):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
+  BUILD_FINGERPRINT := $(PRODUCT_BRAND)/$(TARGET_PRODUCT)/$(TARGET_DEVICE):$(PLATFORM_VERSION)/$(BUILD_ID)/$(BUILD_NUMBER):$(TARGET_BUILD_VARIANT)/$(BUILD_VERSION_TAGS)
 endif
 ifneq ($(words $(BUILD_FINGERPRINT)),1)
   $(error BUILD_FINGERPRINT cannot contain spaces: "$(BUILD_FINGERPRINT)")
@@ -874,8 +874,6 @@
 .PHONY: userdataimage-nodeps
 userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
 	$(build-userdataimage-target)
-	$(hide)mkdir -p $(DIST_DIR)
-	$(hide)cp $(INSTALLED_USERDATAIMAGE_TARGET) $(DIST_DIR)
 
 #######
 ## data partition tarball
@@ -1177,12 +1175,15 @@
 .PHONY: tests-zip-package
 tests-zip-package: $(BUILT_TESTS_ZIP_PACKAGE)
 
-# Dist the files needed by tests builds
-# So the build server can run the following commands to build tests packages while avoid a full build:
-# $make -j16 tests-zip-package userdataimage-nodeps dist showcommands TARGET_BUILD_VARIANT=tests TARGET_PRODUCT=passion
-ifeq ($(filter $(DEFAULT_GOAL) tests-zip-package,$(MAKECMDGOALS)),tests-zip-package)
-  $(call dist-for-goals, tests-zip-package, \
-     $(BUILT_TESTS_ZIP_PACKAGE))
+# Target needed by tests build
+.PHONY: tests-build-target
+tests-build-target: $(BUILT_TESTS_ZIP_PACKAGE) \
+                    $(BUILT_USERDATAIMAGE_TARGET)
+
+ifneq (,$(filter $(MAKECMDGOALS),tests-build-target))
+  $(call dist-for-goals, tests-build-target, \
+          $(BUILT_TESTS_ZIP_PACKAGE) \
+          $(BUILT_USERDATAIMAGE_TARGET))
 endif
 
 # -----------------------------------------------------------------
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 04270f0..97bcbaa 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -71,7 +71,31 @@
 
 ifneq ($(filter $(LOCAL_MODULE_TAGS),user),)
   ifeq ($(filter $(GRANDFATHERED_USER_MODULES),$(LOCAL_MODULE)),)
-    $(warning using user tag on $(LOCAL_MODULE) at $(LOCAL_PATH))
+    $(warning *** Module name: $(LOCAL_MODULE))
+    $(warning *** Makefile location: $(LOCAL_PATH))
+    $(warning * )
+    $(warning * Each module must use a LOCAL_MODULE_TAGS in its)
+    $(warning * Android.mk. Possible tags declared by a module:)
+    $(warning * )
+    $(warning *     optional, debug, eng, tests, samples)
+    $(warning * )
+    $(warning * If the module is expected to be in all builds)
+    $(warning * of a product, then it should use the)
+    $(warning * "optional" tag: )
+    $(warning * )
+    $(warning *    Add "LOCAL_MODULE_TAGS := optional" in the)
+    $(warning *    Android.mk for the affected module, and add)
+    $(warning *    the LOCAL_MODULE value for that component)
+    $(warning *    into the PRODUCT_PACKAGES section of product)
+    $(warning *    makefile(s) where it's necessary, if)
+    $(warning *    appropriate.)
+    $(warning * )
+    $(warning * If the component should be in EVERY build of ALL)
+    $(warning * products, then add its LOCAL_MODULE value to the)
+    $(warning * PRODUCT_PACKAGES section of)
+    $(warning * build/target/product/core.mk)
+    $(warning * )
+    $(error user tag detected on new module - user tags are only supported on legacy modules)
   endif
 endif
 
diff --git a/core/definitions.mk b/core/definitions.mk
index 7c69ce1..09a8829 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -534,6 +534,30 @@
 endef
 
 ###########################################################
+## Run rot13 on a string
+## $(1): the string.  Must be one line.
+###########################################################
+define rot13
+$(shell echo $(1) | tr 'a-zA-Z' 'n-za-mN-ZA-M')
+endef
+
+
+###########################################################
+## Returns true if $(1) and $(2) are equal.  Returns
+## the empty string if they are not equal.
+###########################################################
+define streq
+$(strip $(if $(strip $(1)),\
+  $(if $(strip $(2)),\
+    $(if $(filter-out __,_$(subst $(strip $(1)),,$(strip $(2)))$(subst $(strip $(2)),,$(strip $(1)))_),,true), \
+    ),\
+  $(if $(strip $(2)),\
+    ,\
+    true)\
+ ))
+endef
+
+###########################################################
 ## Convert "a b c" into "a:b:c"
 ###########################################################
 
diff --git a/core/main.mk b/core/main.mk
index 325a0e5..37ac39e 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -472,6 +472,13 @@
 
 endif	# !SDK_ONLY
 
+# Before we go and include all of the module makefiles, stash away
+# the PRODUCT_* values so you can't get to them.
+stash_product_vars:=#true
+ifeq ($(stash_product_vars),true)
+  $(call stash-product-vars, __STASHED, DO_NOT_USE_IN_ANDROID_MK_)
+endif
+
 ifneq ($(ONE_SHOT_MAKEFILE),)
 # We've probably been invoked by the "mm" shell function
 # with a subdirectory's makefile.
@@ -502,6 +509,11 @@
 include $(subdir_makefiles)
 endif # ONE_SHOT_MAKEFILE
 
+ifeq ($(stash_product_vars),true)
+  $(call assert-product-vars, __STASHED, DO_NOT_USE_IN_ANDROID_MK_)
+  $(call restore-product-vars, __STASHED)
+endif
+
 # -------------------------------------------------------------------
 # All module makefiles have been included at this point.
 # -------------------------------------------------------------------
@@ -750,17 +762,6 @@
     $(INSTALLED_RAMDISK_TARGET) \
    )
 
-  # Tests are installed in userdata.img.  If we're building the tests
-  # variant, copy it for "make tests dist".  Also copy a zip of the
-  # contents of userdata.img, so that people can easily extract a
-  # single .apk.
-  ifeq ($(TARGET_BUILD_VARIANT),tests)
-  $(call dist-for-goals, droid, \
-    $(INSTALLED_USERDATAIMAGE_TARGET) \
-    $(BUILT_TESTS_ZIP_PACKAGE) \
-   )
-  endif
-
 # Building a full system-- the default is to build droidcore
 droid: droidcore dist_libraries
 
diff --git a/core/product.mk b/core/product.mk
index 7594f6f..e425e02 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -186,3 +186,47 @@
 define resolve-short-product-name
 $(strip $(call _resolve-short-product-name,$(1)))
 endef
+
+
+#
+# Rename the variables in _product_var_list.
+# $(1): Renamed prefix
+# $(2): New value prefix.  The new value will be $(2)$(VARNAME)
+#
+define stash-product-vars
+$(foreach v,$(_product_var_list), \
+        $(eval $(strip $(1))_$(call rot13,$(v)):=$$($$(v))) \
+        $(eval $(v):=$(2)$$(v)) \
+ )
+endef
+
+#
+# Assert that the the variable stashed by stash-product-vars remains untouched.
+# $(1): The prefix as supplied to stash-product-vars
+# $(2): The expected value prefix.  The value should be $(2)$(VARNAME)
+#
+define assert-product-vars
+$(strip \
+  $(eval changed_variables:=)
+  $(foreach v,$(_product_var_list), \
+    $(if $(call streq,$($(v)),$(2)$(v)),, \
+        $(eval $(warning $(v) has been modified: $($(v)))) \
+        $(eval changed_variables := $(changed_variables) $(v))) \
+   ) \
+  $(if $(changed_variables),\
+    $(eval $(error The following variables have been changed: $(changed_variables))),)
+)
+endef
+# ... $(eval $(warning $(v) $($(v)),$(2)$(v) streq-->$(call streq,$($(v)),$(2)$(v)))) \
+
+#
+# Restore the product variables as stashed by stash-product-vars
+# $(1): The prefix as supplied to stash-product-vars
+#
+define restore-product-vars
+$(foreach v,$(_product_var_list), \
+        $(eval $(v):=$($(strip $(1))_$(call rot13,$(v)))) \
+        $(eval $(strip $(1))_$(v):=) \
+ )
+endef
+
diff --git a/core/product_config.mk b/core/product_config.mk
index 7f79ff7..4824245 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -119,6 +119,11 @@
     default_goal_substitution := $(DEFAULT_GOAL)
   endif
 
+  # For tests build, only build tests-build-target
+  ifeq (tests,$(TARGET_BUILD_VARIANT))
+    default_goal_substitution := tests-build-target
+  endif
+
   # Hack to make the linux build servers use dexpreopt (emulator-based
   # preoptimization). Most engineers don't use this type of target
   # ("make PRODUCT-blah-user"), so this should only tend to happen when
diff --git a/core/user_tags.mk b/core/user_tags.mk
index b242e3a..9588c0b 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -32,6 +32,8 @@
 	aapt \
 	acp \
 	adb \
+	AdbWinApi \
+	AdbWinUsbApi \
 	adbd \
 	aidl \
 	am \
@@ -96,6 +98,7 @@
 	descGen \
 	dexdeps \
 	dexdump \
+	dexgen \
 	dexlist \
 	dexopt \
 	dexpreopt \
@@ -138,6 +141,7 @@
 	fastboot \
 	framework \
 	FrameworkCoreHostTests \
+	frameworks-core-util-lib \
 	fsck_msdos \
 	fs_get_stats \
 	fw_bcm4329_apsta.bin \
@@ -165,6 +169,7 @@
 	init \
 	input \
 	installd \
+	ip \
 	iptables \
 	ip-up-vpn \
 	iself \
@@ -186,6 +191,7 @@
 	kcm \
 	keystore \
 	kxml2-2.3.0 \
+	launch-wrapper \
 	layoutlib \
 	layoutlib_api \
 	layoutlib_create \
@@ -292,6 +298,7 @@
 	libjni_latinime \
 	libjni_pinyinime \
 	libjpeg \
+	libjs \
 	liblinenoise \
 	libLLVMAnalysis \
 	libLLVMARMAsmPrinter \
@@ -440,6 +447,7 @@
 	libvpx \
 	libwebcore \
 	libwpa_client \
+	libwrapsim \
 	libxml2 \
 	libxslt \
 	libz \
@@ -517,10 +525,12 @@
 	rild \
 	rsg-generator \
 	run-as \
+	runtime \
 	schedtest \
 	screenshot \
 	screenshot2 \
 	sdcard \
+	sdklauncher \
 	sdklib \
 	sdkmanager \
 	sdkstats \
@@ -540,6 +550,7 @@
 	signapk \
 	signature-tools \
 	simg2img \
+	simulator \
 	slang \
 	soslim \
 	spec-progress \
diff --git a/target/board/Android.mk b/target/board/Android.mk
index ac8cb44..82dee3c 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -23,16 +23,7 @@
 # Use the add-radio-file function to add values to this variable.
 INSTALLED_RADIOIMAGE_TARGET :=
 
-ifeq (,$(wildcard $(TARGET_DEVICE_DIR)/AndroidBoard.mk))
-  ifeq (,$(wildcard $(TARGET_DEVICE_DIR)/Android.mk))
-    $(error Missing "$(TARGET_DEVICE_DIR)/AndroidBoard.mk")
-  else
-    # TODO: Remove this check after people have had a chance to switch,
-    # after April 2009.
-    $(error Please rename "$(TARGET_DEVICE_DIR)/Android.mk" to "$(TARGET_DEVICE_DIR)/AndroidBoard.mk")
-  endif
-endif
-include $(TARGET_DEVICE_DIR)/AndroidBoard.mk
+-include $(TARGET_DEVICE_DIR)/AndroidBoard.mk
 
 # Generate a file that contains various information about the
 # device we're building for.  This file is typically packaged up
diff --git a/target/product/generic.mk b/target/product/generic.mk
index 51e17f3..9bb794c 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -47,6 +47,10 @@
     CalendarProvider \
     SyncProvider
 
+PRODUCT_PACKAGES += \
+    icu.dat
+
+$(call inherit-product-if-exists, frameworks/base/data/fonts/fonts.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
 
 # Overrides