Merge "cherrypick from Change-Id: I2722879ee7f246e34acca7fd9fb84acff4e8540d docs: some css for android u and javascript"
diff --git a/core/Makefile b/core/Makefile
index c5e30c2..837b300 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -723,9 +723,6 @@
 # -----------------------------------------------------------------
 # system image
 #
-systemimage_intermediates := \
-	$(call intermediates-dir-for,PACKAGING,systemimage)
-BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
 
 INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
 	$(ALL_PREBUILT) \
@@ -733,6 +730,33 @@
 	$(ALL_GENERATED_SOURCES) \
 	$(ALL_DEFAULT_INSTALLED_MODULES))
 
+FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
+# -----------------------------------------------------------------
+# installed file list
+# Depending on anything that $(BUILT_SYSTEMIMAGE) depends on.
+# We put installed-files.txt ahead of image itself in the dependency graph
+# so that we can get the size stat even if the build fails due to too large
+# system image.
+INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
+$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS)
+	@echo Installed file list: $@
+	@mkdir -p $(dir $@)
+	@rm -f $@
+	$(hide) build/tools/fileslist.py $(TARGET_OUT) > $@
+
+.PHONY: installed-file-list
+installed-file-list: $(INSTALLED_FILES_FILE)
+ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
+$(call dist-for-goals, sdk win_sdk, $(INSTALLED_FILES_FILE))
+endif
+ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
+$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
+endif
+
+systemimage_intermediates := \
+	$(call intermediates-dir-for,PACKAGING,systemimage)
+BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
+
 ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
 ## generate an ext image
 # $(1): output file
@@ -752,7 +776,7 @@
 endef
 endif # INTERNAL_USERIMAGES_USE_EXT
 
-$(BUILT_SYSTEMIMAGE): $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
+$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)
 	$(call build-systemimage-target,$@)
 
 INSTALLED_SYSTEMIMAGE := $(PRODUCT_OUT)/system.img
@@ -1078,9 +1102,11 @@
 endif
 	@# Zip everything up, preserving symlinks
 	$(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .)
-	@# Run fs_config on all the system files in the zip, and save the output
-	$(hide) zipinfo -1 $@ | awk -F/ 'BEGIN { OFS="/" } /^SYSTEM\// {$$1 = "system"; print}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt
-	$(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/filesystem_config.txt)
+	@# Run fs_config on all the system, boot ramdisk, and recovery ramdisk files in the zip, and save the output
+	$(hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/filesystem_config.txt
+	$(hide) zipinfo -1 $@ | awk 'BEGIN { FS="BOOT/RAMDISK/" } /^BOOT\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/boot_filesystem_config.txt
+	$(hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config > $(zip_root)/META/recovery_filesystem_config.txt
+	$(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/*filesystem_config.txt)
 
 
 target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
@@ -1148,26 +1174,6 @@
 endif    # TARGET_PRODUCT != sdk
 
 # -----------------------------------------------------------------
-# installed file list
-# Depending on $(INSTALLED_SYSTEMIMAGE) ensures that it
-# gets the DexOpt one if we're doing that.
-INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
-$(INSTALLED_FILES_FILE): $(INSTALLED_SYSTEMIMAGE)
-	@echo Installed file list: $@
-	@mkdir -p $(dir $@)
-	@rm -f $@
-	$(hide) build/tools/fileslist.py $(TARGET_OUT) $(TARGET_OUT_DATA) > $@
-
-.PHONY: installed-file-list
-installed-file-list: $(INSTALLED_FILES_FILE)
-ifneq ($(filter sdk win_sdk,$(MAKECMDGOALS)),)
-$(call dist-for-goals, sdk win_sdk, $(INSTALLED_FILES_FILE))
-endif
-ifneq ($(filter sdk_addon,$(MAKECMDGOALS)),)
-$(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE))
-endif
-
-# -----------------------------------------------------------------
 # A zip of the tests that are built when running "make tests".
 # This is very similar to BUILT_TARGET_FILES_PACKAGE, but we
 # only grab SYSTEM and DATA, and it's called "*-tests-*.zip".
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 635a256..8039d65 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -194,14 +194,8 @@
 LOCAL_BUILT_MODULE := $(built_module_path)/$(LOCAL_BUILT_MODULE_STEM)
 built_module_path :=
 
-# LOCAL_UNINSTALLABLE_MODULE is only allowed to be used by the
-# internal STATIC_LIBRARIES build files.
 LOCAL_UNINSTALLABLE_MODULE := $(strip $(LOCAL_UNINSTALLABLE_MODULE))
-ifdef LOCAL_UNINSTALLABLE_MODULE
-  ifeq (,$(filter $(LOCAL_MODULE_CLASS),JAVA_LIBRARIES STATIC_LIBRARIES))
-    $(error $(LOCAL_PATH): Illegal use of LOCAL_UNINSTALLABLE_MODULE)
-  endif
-else
+ifneq (true,$(LOCAL_UNINSTALLABLE_MODULE))
   LOCAL_INSTALLED_MODULE := $(LOCAL_MODULE_PATH)/$(LOCAL_INSTALLED_MODULE_STEM)
 endif
 
diff --git a/core/binary.mk b/core/binary.mk
index dadfd5e..1a5af5f 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -56,7 +56,8 @@
     endif
   else
     # LOCAL_NDK_STL_VARIANT is gnustl_static
-    my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
+    my_ndk_stl_include_path := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/include \
+                               $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/include
     my_ndk_stl_static_lib := $(my_ndk_source_root)/cxx-stl/gnu-libstdc++/libs/$(TARGET_CPU_ABI)/libstdc++.a
   endif
   endif
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 1b9bb8a..c5e4cc7 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -106,6 +106,7 @@
 LOCAL_RENDERSCRIPT_INCLUDES:=
 LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE:=
 LOCAL_RENDERSCRIPT_CC:=
+LOCAL_RENDERSCRIPT_TARGET_API:=
 LOCAL_BUILD_HOST_DEX:=
 LOCAL_DEX_PREOPT:=
 LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,full
diff --git a/core/definitions.mk b/core/definitions.mk
index 466a482..1afc0f4 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -312,7 +312,7 @@
 
 define find-subdir-assets
 $(if $(1),$(patsubst ./%,%, \
-	$(shell if [ -d $(1) ] ; then cd $(1) ; find ./ -type f -and -not -type l ; fi)), \
+	$(shell if [ -d $(1) ] ; then cd $(1) ; find ./ -not -name '.*' -and -type f -and -not -type l ; fi)), \
 	$(warning Empty argument supplied to find-subdir-assets) \
 )
 endef
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 67709f4..b801ac2 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -4,7 +4,7 @@
 ####################################
 
 # TODO: replace it with device's BOOTCLASSPATH
-DEXPREOPT_BOOT_JARS := core:apache-xml:bouncycastle:ext:framework:android.policy:services:core-junit:filterfw
+DEXPREOPT_BOOT_JARS := core:core-junit:bouncycastle:ext:framework:android.policy:services:apache-xml:filterfw
 DEXPREOPT_BOOT_JARS_MODULES := $(subst :, ,$(DEXPREOPT_BOOT_JARS))
 
 DEXPREOPT_BUILD_DIR := $(OUT_DIR)
diff --git a/core/java.mk b/core/java.mk
index 16cbb9c..1cde62b 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -136,18 +136,17 @@
 renderscript_intermediate := $(LOCAL_INTERMEDIATE_SOURCE_DIR)/renderscript
 
 renderscript_target_api :=
+
+ifneq (,$(LOCAL_RENDERSCRIPT_TARGET_API))
+renderscript_target_api := $(LOCAL_RENDERSCRIPT_TARGET_API)
+else
 ifneq (,$(LOCAL_SDK_VERSION))
-# Only HC (version 11) should be using the prebuilt RS tools.
-ifeq (11,$(LOCAL_SDK_VERSION))
-ifeq ($(LOCAL_RENDERSCRIPT_CC),)
-LOCAL_RENDERSCRIPT_CC := prebuilt/$(HOST_PREBUILT_TAG)/llvm-rs-cc/llvm-rs-cc
-endif
-endif
-# Set target-api for LOCAL_SDK_VERSIONs other than 11 and current.
-ifneq (,$(filter-out 11 current, $(LOCAL_SDK_VERSION)))
+# Set target-api for LOCAL_SDK_VERSIONs other than current.
+ifneq (,$(filter-out current, $(LOCAL_SDK_VERSION)))
 renderscript_target_api := $(LOCAL_SDK_VERSION)
 endif
 endif  # LOCAL_SDK_VERSION is set
+endif  # LOCAL_RENDERSCRIPT_TARGET_API is set
 
 ifeq ($(LOCAL_RENDERSCRIPT_CC),)
 LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC)
diff --git a/core/main.mk b/core/main.mk
index 0c10c5e..1f03355 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -446,6 +446,7 @@
 	sdk/sdkstats \
 	sdk/sdkmanager \
 	sdk/swtmenubar \
+	sdk/traceview \
 	development/apps \
 	development/tools/mkstubs \
 	packages
diff --git a/core/multi_prebuilt.mk b/core/multi_prebuilt.mk
index 7602673..50a4a38 100644
--- a/core/multi_prebuilt.mk
+++ b/core/multi_prebuilt.mk
@@ -22,6 +22,7 @@
 prebuilt_static_java_libraries := $(LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES)
 prebuilt_is_host := $(LOCAL_IS_HOST_MODULE)
 prebuilt_module_tags := $(LOCAL_MODULE_TAGS)
+prebuilt_strip_module := $(LOCAL_STRIP_MODULE)
 
 
 ifndef multi_prebuilt_once
@@ -34,6 +35,7 @@
 # $(5): OVERRIDE_BUILT_MODULE_PATH
 # $(6): UNINSTALLABLE_MODULE
 # $(7): BUILT_MODULE_STEM
+# $(8): LOCAL_STRIP_MODULE
 #
 # Elements in the file list may be bare filenames,
 # or of the form "<modulename>:<filename>".
@@ -65,6 +67,8 @@
     $(eval LOCAL_BUILT_MODULE_STEM := $(notdir $(LOCAL_SRC_FILES))) \
    ) \
   $(eval LOCAL_MODULE_SUFFIX := $(suffix $(LOCAL_SRC_FILES))) \
+  $(if $(filter user,$(TARGET_BUILD_VARIANT)), \
+    $(eval LOCAL_STRIP_MODULE := $(8))) \
   $(eval include $(BUILD_PREBUILT)) \
  )
 endef
@@ -85,7 +89,10 @@
     $(prebuilt_is_host), \
     SHARED_LIBRARIES, \
     $(prebuilt_module_tags), \
-    $($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES))
+    $($(if $(prebuilt_is_host),HOST,TARGET)_OUT_INTERMEDIATE_LIBRARIES), \
+    , \
+    , \
+    $(prebuilt_strip_module))
 
 $(call auto-prebuilt-boilerplate, \
     $(prebuilt_executables), \
diff --git a/core/user_tags.mk b/core/user_tags.mk
index c1c8ccf..d09a2cd 100644
--- a/core/user_tags.mk
+++ b/core/user_tags.mk
@@ -69,7 +69,6 @@
 	check_stack \
 	check_trace \
 	cmu2nuance \
-	com.android.inputmethod.pinyin.lib \
 	com.android.phone.common \
 	com.android.vcard \
 	commons-compress-1.0 \
@@ -254,7 +253,6 @@
 	libiptc \
 	libjnigraphics \
 	libjni_latinime \
-	libjni_pinyinime \
 	libjpeg \
 	libjs \
 	liblinenoise \
diff --git a/target/board/generic_armv5/AndroidBoard.mk b/target/board/generic_armv5/AndroidBoard.mk
new file mode 100644
index 0000000..7daff27
--- /dev/null
+++ b/target/board/generic_armv5/AndroidBoard.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2011 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.
+#
+
+-include build/target/board/generic/AndroidBoard.mk
diff --git a/target/board/generic_armv5/BoardConfig.mk b/target/board/generic_armv5/BoardConfig.mk
new file mode 100644
index 0000000..d8fa2fe
--- /dev/null
+++ b/target/board/generic_armv5/BoardConfig.mk
@@ -0,0 +1,23 @@
+#
+# Copyright (C) 2011 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.
+#
+
+include build/target/board/generic/BoardConfig.mk
+
+TARGET_ARCH_VARIANT :=
+TARGET_CPU_ABI := armeabi
+TARGET_CPU_ABI2 :=
+
+WITH_DEXPREOPT := false
diff --git a/target/board/generic_armv5/README.txt b/target/board/generic_armv5/README.txt
new file mode 100644
index 0000000..25d590a
--- /dev/null
+++ b/target/board/generic_armv5/README.txt
@@ -0,0 +1,5 @@
+The "generic_armv5" product defines a non-hardware-specific target
+without a kernel or bootloader.
+
+It is not a product "base class"; no other products inherit
+from it or use it in any way.
diff --git a/target/board/generic_armv5/device.mk b/target/board/generic_armv5/device.mk
new file mode 100644
index 0000000..7c4aaf2
--- /dev/null
+++ b/target/board/generic_armv5/device.mk
@@ -0,0 +1,17 @@
+#
+# Copyright (C) 2011 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.
+#
+
+include build/target/board/generic/device.mk
diff --git a/target/board/generic_armv5/system.prop b/target/board/generic_armv5/system.prop
new file mode 100644
index 0000000..137a0f9
--- /dev/null
+++ b/target/board/generic_armv5/system.prop
@@ -0,0 +1,6 @@
+#
+# system.prop for generic sdk
+#
+
+rild.libpath=/system/lib/libreference-ril.so
+rild.libargs=-d /dev/ttyS0
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 44b9000..e77c783 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -35,6 +35,7 @@
 PRODUCT_MAKEFILES := \
     $(LOCAL_DIR)/core.mk \
     $(LOCAL_DIR)/generic.mk \
+    $(LOCAL_DIR)/generic_armv5.mk \
     $(LOCAL_DIR)/generic_x86.mk \
     $(LOCAL_DIR)/full.mk \
     $(LOCAL_DIR)/full_x86.mk \
diff --git a/target/product/generic_armv5.mk b/target/product/generic_armv5.mk
new file mode 100644
index 0000000..d419e70
--- /dev/null
+++ b/target/product/generic_armv5.mk
@@ -0,0 +1,26 @@
+#
+# Copyright (C) 2011 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.
+#
+
+# This is a generic product that isn't specialized for a specific device.
+# It includes the base Android platform.
+
+$(call inherit-product, $(SRC_TARGET_DIR)/product/generic.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/core.mk)
+
+# Overrides
+PRODUCT_BRAND := generic_armv5
+PRODUCT_DEVICE := generic_armv5
+PRODUCT_NAME := generic_armv5
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index c31e5f7..6e052fd 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -30,7 +30,7 @@
     DrmProvider \
     Email \
     Exchange \
-    GalleryNew3D \
+    Gallery2 \
     LatinIME \
     Launcher2 \
     Music \
diff --git a/target/product/large_emu_hw.mk b/target/product/large_emu_hw.mk
index f38ef61..9224130 100644
--- a/target/product/large_emu_hw.mk
+++ b/target/product/large_emu_hw.mk
@@ -32,7 +32,7 @@
     DrmProvider \
     Email \
     Exchange \
-    GalleryNew3D \
+    Gallery2 \
     LatinIME \
     Launcher2 \
     Music \
diff --git a/tools/fileslist.py b/tools/fileslist.py
index ae1b4b6..a11efaa 100755
--- a/tools/fileslist.py
+++ b/tools/fileslist.py
@@ -15,7 +15,7 @@
 # limitations under the License.
 #
 
-import os, sys
+import operator, os, sys
 
 def get_file_size(path):
   st = os.lstat(path)
@@ -37,9 +37,9 @@
           output.append(row)
         except os.error:
           pass
+  output.sort(key=operator.itemgetter(0), reverse=True)
   for row in output:
     print "%12d  %s" % row
 
 if __name__ == '__main__':
   main(sys.argv)
-