am d792d355: (-s ours) Reconcile with jb-mr1-release - do not merge

* commit 'd792d355f3828eac7005200395f87e4998ff2adf':
  JOO46
  JOO45C
  JOO45B
  JOO45
  JOO44B
  JOO44
  JOO40D
  JOO40C
diff --git a/core/binary.mk b/core/binary.mk
index e17efa4..67f3544 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -130,6 +130,7 @@
 my_compiler_dependencies :=
 ifeq ($(strip $(LOCAL_CLANG)),true)
   LOCAL_CFLAGS += $(CLANG_CONFIG_EXTRA_CFLAGS)
+  LOCAL_ASFLAGS += $(CLANG_CONFIG_EXTRA_ASFLAGS)
   LOCAL_LDFLAGS += $(CLANG_CONFIG_EXTRA_LDFLAGS)
   my_compiler_dependencies := $(CLANG) $(CLANG_CXX)
 endif
diff --git a/core/config.mk b/core/config.mk
index aa4e7f1..e3b1199 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -276,7 +276,6 @@
 AAPT := $(HOST_OUT_EXECUTABLES)/aapt$(HOST_EXECUTABLE_SUFFIX)
 AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX)
 PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX)
-ICUDATA := $(HOST_OUT_EXECUTABLES)/icudata$(HOST_EXECUTABLE_SUFFIX)
 SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX)
 MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
 MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
diff --git a/core/definitions.mk b/core/definitions.mk
index bf8ce58..e8ec8a7 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -924,15 +924,13 @@
 	    $(PRIVATE_TARGET_GLOBAL_CFLAGS) \
 	    $(PRIVATE_ARM_CFLAGS) \
 	 ) \
-	$(PRIVATE_CFLAGS) \
-	$(1) \
-	$(PRIVATE_DEBUG_CFLAGS) \
+	 $(1) \
 	-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
 endef
 
 define transform-c-to-o-no-deps
 @echo "target $(PRIVATE_ARM_MODE) C: $(PRIVATE_MODULE) <= $<"
-$(call transform-c-or-s-to-o-no-deps, )
+$(call transform-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
 endef
 
 define transform-s-to-o-no-deps
@@ -958,7 +956,7 @@
 
 define transform-m-to-o-no-deps
 @echo "target ObjC: $(PRIVATE_MODULE) <= $<"
-$(call transform-c-or-s-to-o-no-deps)
+$(call transform-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
 endef
 
 define transform-m-to-o
@@ -1013,15 +1011,13 @@
 	$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
 	    $(HOST_GLOBAL_CFLAGS) \
 	 ) \
-	$(PRIVATE_CFLAGS) \
 	$(1) \
-	$(PRIVATE_DEBUG_CFLAGS) \
 	-MD -MF $(patsubst %.o,%.d,$@) -o $@ $<
 endef
 
 define transform-host-c-to-o-no-deps
 @echo "host C: $(PRIVATE_MODULE) <= $<"
-$(call transform-host-c-or-s-to-o-no-deps, )
+$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
 endef
 
 define transform-host-s-to-o-no-deps
@@ -1045,7 +1041,7 @@
 
 define transform-host-m-to-o-no-deps
 @echo "host ObjC: $(PRIVATE_MODULE) <= $<"
-$(call transform-host-c-or-s-to-o-no-deps)
+$(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS))
 endef
 
 define transform-host-m-to-o
@@ -1484,7 +1480,6 @@
 define transform-java-to-classes.jar
 @echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))"
 $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH))
-$(hide) rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR)
 endef
 
 # Override the above definitions if we want to do incremetal javac
@@ -1617,12 +1612,27 @@
 $(AAPT) add -k $@ $$_adtp_classes_dex && rm -f $$_adtp_classes_dex)
 endef
 
+# Add java resources added by the current module.
+#
 define add-java-resources-to-package
 $(call dump-words-to-file, $(PRIVATE_EXTRA_JAR_ARGS), $(dir $@)jar-arg-list)
 $(hide) jar uf $@ @$(dir $@)jar-arg-list
 @rm -f $(dir $@)jar-arg-list
 endef
 
+# Add java resources carried by static Java libraries.
+#
+define add-carried-java-resources
+$(hide) if [ -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) ] ; then \
+    java_res_jar_flags=$$(find $(PRIVATE_CLASS_INTERMEDIATES_DIR) -type f -a -not -name "*.class" \
+        | sed -e "s?^$(PRIVATE_CLASS_INTERMEDIATES_DIR)/? -C $(PRIVATE_CLASS_INTERMEDIATES_DIR) ?"); \
+    if [ -n "$$java_res_jar_flags" ] ; then \
+        echo $$java_res_jar_flags >$(dir $@)java_res_jar_flags; \
+        jar uf $@ $$java_res_jar_flags; \
+    fi; \
+fi
+endef
+
 # Sign a package using the specified key/cert.
 #
 define sign-package
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 6cc0b1f..5930da6 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -82,6 +82,7 @@
 	@echo "Host Jar: $(PRIVATE_MODULE) ($@)"
 	$(create-empty-package)
 	$(add-dex-to-package)
+	$(add-carried-java-resources)
 ifneq ($(extra_jar_args),)
 	$(add-java-resources-to-package)
 endif
diff --git a/core/java_library.mk b/core/java_library.mk
index 06cdfc4..58d9ba6 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -67,6 +67,7 @@
 	@echo "target Jar: $(PRIVATE_MODULE) ($@)"
 	$(create-empty-package)
 	$(add-dex-to-package)
+	$(add-carried-java-resources)
 ifneq ($(extra_jar_args),)
 	$(add-java-resources-to-package)
 endif
diff --git a/core/llvm_config.mk b/core/llvm_config.mk
index 6d08e78..b1b21e4 100644
--- a/core/llvm_config.mk
+++ b/core/llvm_config.mk
@@ -53,6 +53,8 @@
     -mfpmath=sse \
     -mbionic
 endif
+#TODO: split out the asflags from CLANG_CONFIG_EXTRA_CFLAGS.
+CLANG_CONFIG_EXTRA_ASFLAGS := $(CLANG_CONFIG_EXTRA_CFLAGS)
 
 CLANG_CONFIG_EXTRA_TARGET_C_INCLUDES := external/clang/lib/include $(TARGET_OUT_HEADERS)/clang
 
diff --git a/core/package.mk b/core/package.mk
index a1d901e..7b10c33 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -53,14 +53,6 @@
 endif
 LOCAL_MODULE := $(LOCAL_PACKAGE_NAME)
 
-# Android packages should use Android resources or assets.
-ifneq (,$(LOCAL_JAVA_RESOURCE_DIRS))
-$(error $(LOCAL_PATH): Package modules may not set LOCAL_JAVA_RESOURCE_DIRS)
-endif
-ifneq (,$(LOCAL_JAVA_RESOURCE_FILES))
-$(error $(LOCAL_PATH): Package modules may not set LOCAL_JAVA_RESOURCE_FILES)
-endif
-
 ifeq ($(strip $(LOCAL_MANIFEST_FILE)),)
 LOCAL_MANIFEST_FILE := AndroidManifest.xml
 endif
@@ -384,6 +376,10 @@
 ifneq ($(full_classes_jar),)
 	$(add-dex-to-package)
 endif
+	$(add-carried-java-resources)
+ifneq ($(extra_jar_args),)
+	$(add-java-resources-to-package)
+endif
 	$(sign-package)
 	@# Alignment must happen after all other zip operations.
 	$(align-package)
diff --git a/core/user_tags.mk b/core/user_tags.mk
index 517af49..8c38d66 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -146,7 +146,6 @@
 	hierarchyviewerlib \
 	hist_trace \
 	hosttestlib \
-	icudata \
 	idegen \
 	ime \
 	init \
@@ -176,8 +175,6 @@
 	libandroid_runtime \
 	libandroid_servers \
 	libarity \
-	libastl \
-	libastl_host \
 	libaudio \
 	libaudioeffect_jni \
 	libaudioflinger \
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 9279633..796b79f 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -25,12 +25,12 @@
 # it includes.
 #
 
-# Unbundled apps will be built with the default product config.
+# Unbundled apps will be built with the most generic product config.
 ifneq ($(TARGET_BUILD_APPS),)
 PRODUCT_MAKEFILES := \
-    $(LOCAL_DIR)/core.mk \
-    $(LOCAL_DIR)/generic.mk \
-    $(LOCAL_DIR)/full.mk
+    $(LOCAL_DIR)/full.mk \
+    $(LOCAL_DIR)/full_x86.mk \
+    $(LOCAL_DIR)/full_mips.mk
 else
 PRODUCT_MAKEFILES := \
     $(LOCAL_DIR)/core.mk \
diff --git a/tools/bin2asm/Android.mk b/tools/bin2asm/Android.mk
deleted file mode 100644
index 4522a20..0000000
--- a/tools/bin2asm/Android.mk
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (C) 2008 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.
-
-LOCAL_PATH:= $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
-    icudata.c
-
-LOCAL_MODULE := icudata
-
-include $(BUILD_HOST_EXECUTABLE)
-
diff --git a/tools/bin2asm/data b/tools/bin2asm/data
deleted file mode 100644
index 3be865f..0000000
--- a/tools/bin2asm/data
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * Convert a data file into a .S file suitable for assembly.
- * This reads from stdin and writes to stdout and takes a single
- * argument for the name of the symbol in the assembly file.
- */
-
-#include <stdio.h>
-
-int main(int argc, char *argv[]) {
-    unsigned char buf[4096];
-    size_t amt;
-    size_t i;
-    int col = 0;
-    char *name = argv[1];
-
-    printf("\
-#ifdef __APPLE_CC__\n\
-/*\n\
- * The mid-2007 version of gcc that ships with Macs requires a\n\
- * comma on the .section line, but the rest of the world thinks\n\
- * that's a syntax error. It also wants globals to be explicitly\n\
- * prefixed with \"_\" as opposed to modern gccs that do the\n\
- * prefixing for you.\n\
- */\n\
-.globl _%s\n\
-	.section .rodata,\n\
-	.align 8\n\
-_%s:\n\
-#else\n\
-.globl %s\n\
-	.section .rodata\n\
-	.align 8\n\
-%s:\n\
-#endif\n\
-", name, name, name, name);
-    
-    while (! feof(stdin)) {
-        amt = fread(buf, 1, sizeof(buf), stdin);
-        for (i = 0; i < amt; i++) {
-            printf((col == 0) ? ".byte %3d" : ",%3d", buf[i]);
-            col++;
-            if (col == 16) {
-                printf("\n");
-                col = 0;
-            }
-        }
-    }
-
-    if (col != 0) {
-        printf("\n");
-    }
-}
diff --git a/tools/bin2asm/icudata.c b/tools/bin2asm/icudata.c
deleted file mode 100644
index ecd1b4b..0000000
--- a/tools/bin2asm/icudata.c
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Convert a data file into a .S file suitable for assembly.
- * This reads from stdin and writes to stdout and takes a single
- * argument for the name of the symbol in the assembly file.
- */
-
-#include <stdio.h>
-
-int main(int argc, char *argv[]) {
-    unsigned char buf[4096];
-    size_t amt;
-    size_t i;
-    int col = 0;
-    char *name;
-
-    if (argc != 2) {
-        fprintf(stderr, "usage: %s NAME < DAT_FILE > ASM_FILE\n", argv[0]);
-        for (i=0; i<argc; i++) {
-            fprintf(stderr, " '%s'", argv[i]);
-        }
-        fprintf(stderr, "\n");
-        return 1;
-    }
-    
-    name = argv[1];
-
-    printf("\
-#ifdef __APPLE_CC__\n\
-/*\n\
- * The mid-2007 version of gcc that ships with Macs requires a\n\
- * comma on the .section line, but the rest of the world thinks\n\
- * that's a syntax error. It also wants globals to be explicitly\n\
- * prefixed with \"_\" as opposed to modern gccs that do the\n\
- * prefixing for you.\n\
- */\n\
-.globl _%s\n\
-	.section .rodata,\n\
-	.align 8\n\
-_%s:\n\
-#else\n\
-.globl %s\n\
-	.section .rodata\n\
-	.align 8\n\
-%s:\n\
-#endif\n\
-", name, name, name, name);
-    
-    while (! feof(stdin)) {
-        amt = fread(buf, 1, sizeof(buf), stdin);
-        for (i = 0; i < amt; i++) {
-            if (col == 0) {
-                printf(".byte ");
-            }
-            printf("0x%02x", buf[i]);
-            col++;
-            if (col == 16) {
-                printf("\n");
-                col = 0;
-            } else if (col % 4 == 0) {
-                printf(", ");
-            } else {
-                printf(",");
-            }
-        }
-    }
-
-    if (col != 0) {
-        printf("\n");
-    }
-
-    return 0;
-}