Merge "Add LOCAL_APK_LIBRARIES argument." into jb-mr2-dev
diff --git a/core/Makefile b/core/Makefile
index 2f86fd7..1e94c60 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -608,6 +608,17 @@
 recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET)
 recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery
 recovery_resources_common := $(call include-path-for, recovery)/res
+
+# Select the 18x32 font on high-density devices; and the 12x22 font on
+# other devices.  Note that the font selected here can be overridden
+# for a particular device by putting a font.png in its private
+# recovery resources.
+ifneq (,$(filter xxhdpi xhdpi,$(subst $(comma),$(space),$(PRODUCT_AAPT_CONFIG))))
+recovery_font := $(call include-path-for, recovery)/fonts/18x32.png
+else
+recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
+endif
+
 recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res))
 recovery_resource_deps := $(shell find $(recovery_resources_common) \
   $(recovery_resources_private) -type f)
@@ -683,6 +694,7 @@
 	$(hide) -cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/
 	$(hide) cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/
 	$(hide) cp -rf $(recovery_resources_common) $(TARGET_RECOVERY_ROOT_OUT)/
+	$(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
 	$(hide) $(foreach item,$(recovery_resources_private), \
 	  cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/)
 	$(hide) $(foreach item,$(recovery_fstab), \
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index 7361ce9..ba61cbf 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -123,9 +123,7 @@
         $(PRIVATE_ALL_OBJECTS) \
         $(addprefix -force_load , $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
         $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
         $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
-        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
         $(PRIVATE_LDLIBS) \
         -o $@ \
         -install_name @rpath/$(notdir $@) \
@@ -144,9 +142,7 @@
         $(call normalize-host-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
         $(PRIVATE_ALL_OBJECTS) \
         $(call normalize-host-libraries,$(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES)) \
-        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
         $(call normalize-host-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
-        $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
         $(PRIVATE_LDFLAGS) \
         $(PRIVATE_LDLIBS) \
         $(HOST_LIBGCC)
diff --git a/core/config.mk b/core/config.mk
index d8d7871..be2c23b 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -443,4 +443,10 @@
 # objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
 TARGET_PREBUILT_TAG := android-$(TARGET_ARCH)
 
-include $(BUILD_SYSTEM)/dumpvar.mk
+# Set up RS prebuilt variables for compatibility library
+
+RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libclcore.bc
+RS_PREBUILT_LIBPATH := -L prebuilts/ndk/8/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib
+RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a
+
+include $(BUILD_SYSTEM)/dumpvar.mk
\ No newline at end of file
diff --git a/core/definitions.mk b/core/definitions.mk
index e895f95..2cf5283 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -826,13 +826,13 @@
 @echo "Renderscript compatibility: $(notdir $@) <= $(notdir $<)"
 $(hide) mkdir -p $(dir $@)
 $(hide) $(BCC_COMPAT) -O3 -o $(dir $@)/$(notdir $(<:.bc=.o)) -fPIC -shared \
-	-rt-path $(PRIVATE_LIBCLCORE) $<
+	-rt-path $(RS_PREBUILT_CLCORE) -mtriple $(RS_TRIPLE) $<
 $(hide) $(PRIVATE_CXX) -shared -Wl,-soname,$(notdir $@) -nostdlib \
 	-Wl,-rpath,\$$ORIGIN/../lib \
 	$(dir $@)/$(notdir $(<:.bc=.o)) \
-	$(PRIVATE_COMPILER_RT) \
+	$(RS_PREBUILT_COMPILER_RT) \
 	-o $@ -L prebuilts/gcc/ \
-	-L $(TARGET_OUT_INTERMEDIATE_LIBRARIES) $(PRIVATE_LIBPATH) \
+	-L $(TARGET_OUT_INTERMEDIATE_LIBRARIES) $(RS_PREBUILT_LIBPATH) \
 	-lRSSupport -lm
 endef
 
diff --git a/core/java.mk b/core/java.mk
index 22b4e75..da670f9 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -196,10 +196,6 @@
 $(RenderScript_file_stamp): $(renderscript_sources_fullpath) $(LOCAL_RENDERSCRIPT_CC)
 	$(transform-renderscripts-to-java-and-bc)
 
-# Now LOCAL_RENDERSCRIPT_COMPATIBILITY only supports arm
-ifneq ($(TARGET_ARCH),arm)
-LOCAL_RENDERSCRIPT_COMPATIBILITY :=
-endif
 ifneq ($(LOCAL_RENDERSCRIPT_COMPATIBILITY),)
 bc_files := $(patsubst %.fs,%.bc, $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources))))
 rs_generated_bc := $(addprefix \
@@ -212,26 +208,14 @@
 
 $(rs_generated_bc) : $(RenderScript_file_stamp)
 
-ifeq (,$(TARGET_BUILD_APPS))
-rs_built_clcore := $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libclcore.bc_intermediates/libclcore.bc
-rs_extra_libpath :=
-rs_compiler_rt := $(call intermediates-dir-for,STATIC_LIBRARIES,libcompiler_rt)/libcompiler_rt.a
-else
-rs_built_clcore := prebuilts/sdk/renderscript/lib/libclcore.bc
-rs_extra_libpath := -L prebuilts/ndk/8/platforms/android-9/arch-arm/usr/lib
-rs_compiler_rt := prebuilts/sdk/renderscript/lib/libcompiler_rt.a
-endif # TARGET_BUILD_APPS
 rs_support_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/libRSSupport.so
 rs_jni_lib := $(TARGET_OUT_INTERMEDIATE_LIBRARIES)/librsjni.so
 LOCAL_JNI_SHARED_LIBRARIES += libRSSupport librsjni
 
-$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(rs_built_clcore) \
+$(rs_compatibility_jni_libs): $(RenderScript_file_stamp) $(RS_PREBUILT_CLCORE) \
     $(rs_support_lib) $(rs_jni_lib) $(rs_compiler_rt)
 $(rs_compatibility_jni_libs): | $(BCC_COMPAT)
 $(rs_compatibility_jni_libs): PRIVATE_CXX := $(TARGET_CXX)
-$(rs_compatibility_jni_libs): PRIVATE_LIBCLCORE := $(rs_built_clcore)
-$(rs_compatibility_jni_libs): PRIVATE_COMPILER_RT := $(rs_compiler_rt)
-$(rs_compatibility_jni_libs): PRIVATE_LIBPATH := $(rs_extra_libpath)
 $(rs_compatibility_jni_libs): $(renderscript_intermediate)/librs.%.so: \
     $(renderscript_intermediate.COMMON)/res/raw/%.bc
 	$(transform-bc-to-so)
diff --git a/core/llvm_config.mk b/core/llvm_config.mk
index 2f59edd..7b21496 100644
--- a/core/llvm_config.mk
+++ b/core/llvm_config.mk
@@ -20,6 +20,7 @@
   -funswitch-loops
 
 ifeq ($(TARGET_ARCH),arm)
+  RS_TRIPLE := armv7-unknown-linux
   CLANG_CONFIG_EXTRA_ASFLAGS += \
     -target arm-linux-androideabi \
     -nostdlibinc \
@@ -41,6 +42,7 @@
     -Wa,--noexecstack
 endif
 ifeq ($(TARGET_ARCH),mips)
+  RS_TRIPLE := mipsel-unknown-linux
   CLANG_CONFIG_EXTRA_ASFLAGS += \
     -target mipsel-linux-androideabi \
     -nostdlibinc \
@@ -65,6 +67,7 @@
     -msynci
 endif
 ifeq ($(TARGET_ARCH),x86)
+  RS_TRIPLE := i686-unknown-linux
   CLANG_CONFIG_EXTRA_ASFLAGS += \
     -target i686-linux-android \
     -nostdlibinc \
diff --git a/envsetup.sh b/envsetup.sh
index 785e56c..542d7b2 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -825,6 +825,11 @@
     fi
 }
 
+function gdbwrapper()
+{
+    $ANDROID_TOOLCHAIN/$GDB -x "$@"
+}
+
 function gdbclient()
 {
    local OUT_ROOT=$(get_abs_build_var PRODUCT_OUT)
@@ -892,7 +897,7 @@
        echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT"
        echo >>"$OUT_ROOT/gdbclient.cmds" ""
 
-       $ANDROID_TOOLCHAIN/$GDB -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
+       gdbwrapper "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE"
   else
        echo "Unable to determine build system output dir."
    fi
@@ -935,6 +940,11 @@
     for dir in `find . -name .repo -prune -o -name .git -prune -o -name res -type d`; do find $dir -type f -name '*\.xml' -print0 | xargs -0 grep --color -n "$@"; done;
 }
 
+function mangrep()
+{
+    find . -name .repo -prune -o -name .git -prune -o -path ./out -prune -o -type f -name 'AndroidManifest.xml' -print0 | xargs -0 grep --color -n "$@"
+}
+
 case `uname -s` in
     Darwin)
         function mgrep()
@@ -1231,6 +1241,19 @@
     fi
 }
 
+# Print colored exit condition
+function pez {
+    "$@"
+    local retval=$?
+    if [ $retval -ne 0 ]
+    then
+        echo -e "\e[0;31mFAILURE\e[00m"
+    else
+        echo -e "\e[0;32mSUCCESS\e[00m"
+    fi
+    return $retval
+}
+
 if [ "x$SHELL" != "x/bin/bash" ]; then
     case `ps -o command -p $$` in
         *bash*)
diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk
index 737a607..b1c4977 100644
--- a/target/board/generic/device.mk
+++ b/target/board/generic/device.mk
@@ -25,8 +25,8 @@
 PRODUCT_COPY_FILES := \
     device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     device/generic/goldfish/data/etc/vold.conf:system/etc/vold.conf \
-    $(call add-to-product-copy-files-if-exists,development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml) \
-    $(call add-to-product-copy-files-if-exists,development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml) \
+    device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
     hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf
 
 PRODUCT_PACKAGES := \
diff --git a/target/board/generic_mips/device.mk b/target/board/generic_mips/device.mk
index 8c770b5..fef52ec 100644
--- a/target/board/generic_mips/device.mk
+++ b/target/board/generic_mips/device.mk
@@ -25,8 +25,8 @@
 PRODUCT_COPY_FILES := \
     device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     device/generic/goldfish/data/etc/vold.conf:system/etc/vold.conf \
-    $(call add-to-product-copy-files-if-exists,development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml) \
-    $(call add-to-product-copy-files-if-exists,development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml) \
+    device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
     hardware/libhardware_legacy/audio/audio_policy.conf:system/etc/audio_policy.conf
 
 PRODUCT_PACKAGES := \
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index d24f3ac..ee13ff3 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -25,8 +25,8 @@
 PRODUCT_COPY_FILES := \
     device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     device/generic/goldfish/data/etc/vold.conf:system/etc/vold.conf \
-    development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
-    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml
+    device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml
 
 PRODUCT_PACKAGES := \
     audio.primary.goldfish
diff --git a/target/board/vbox_x86/device.mk b/target/board/vbox_x86/device.mk
index b03cbd3..6bb1ea6 100644
--- a/target/board/vbox_x86/device.mk
+++ b/target/board/vbox_x86/device.mk
@@ -29,8 +29,8 @@
 PRODUCT_COPY_FILES := \
     device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \
     device/generic/goldfish/data/etc/vold.conf:system/etc/vold.conf \
-    development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
-    development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
+    device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+    device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
     system/core/rootdir/init.rc:root/init.rc \
     build/target/board/vbox_x86/init.vbox_x86.rc:root/init.vbox_x86.rc \
     $(LOCAL_KERNEL):kernel
diff --git a/target/product/emulator.mk b/target/product/emulator.mk
index 018e228..1276a8b 100644
--- a/target/product/emulator.mk
+++ b/target/product/emulator.mk
@@ -15,29 +15,48 @@
 
 #
 # This file is included by other product makefiles to add all the
-# emulator-related host modules to PRODUCT_PACKAGES.
+# emulator-related modules to PRODUCT_PACKAGES.
 #
 
+# Host modules
 PRODUCT_PACKAGES += \
-	emulator \
-	emulator-x86 \
-	emulator-arm \
-	emulator-mips \
-	emulator64-x86 \
-	emulator64-arm \
-	emulator64-mips \
-	libOpenglRender \
-	libGLES_CM_translator \
-	libGLES_V2_translator \
-	libEGL_translator \
-	lib64OpenglRender \
-	lib64GLES_CM_translator \
-	lib64GLES_V2_translator \
-	lib64EGL_translator
+    emulator \
+    emulator-x86 \
+    emulator-arm \
+    emulator-mips \
+    emulator64-x86 \
+    emulator64-arm \
+    emulator64-mips \
+    libOpenglRender \
+    libGLES_CM_translator \
+    libGLES_V2_translator \
+    libEGL_translator \
+    lib64OpenglRender \
+    lib64GLES_CM_translator \
+    lib64GLES_V2_translator \
+    lib64EGL_translator
+
+# Device modules
+PRODUCT_PACKAGES += \
+    egl.cfg \
+    gralloc.goldfish \
+    libGLESv1_CM_emulation \
+    lib_renderControl_enc \
+    libEGL_emulation \
+    libGLESv2_enc \
+    libOpenglSystemCommon \
+    libGLESv2_emulation \
+    libGLESv1_enc \
+    qemu-props \
+    qemud \
+    camera.goldfish \
+    lights.goldfish \
+    gps.goldfish \
+    sensors.goldfish
+
 
 PRODUCT_COPY_FILES += \
     device/generic/goldfish/fstab.goldfish:root/fstab.goldfish \
     device/generic/goldfish/init.goldfish.rc:root/init.goldfish.rc \
     device/generic/goldfish/init.goldfish.sh:system/etc/init.goldfish.sh \
     device/generic/goldfish/ueventd.goldfish.rc:root/ueventd.goldfish.rc
-
diff --git a/target/product/languages_full.mk b/target/product/languages_full.mk
index 0fc13c7..9f6c9ca 100644
--- a/target/product/languages_full.mk
+++ b/target/product/languages_full.mk
@@ -21,4 +21,4 @@
 
 # These 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 hi_IN 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 am_ET hi_IN en_XA ar_XB
+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 hi_IN 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 am_ET hi_IN en_XA ar_XB fr_CA
diff --git a/target/product/sdk.mk b/target/product/sdk.mk
index 82ed538..646881e 100644
--- a/target/product/sdk.mk
+++ b/target/product/sdk.mk
@@ -85,8 +85,8 @@
 	frameworks/base/data/sounds/effects/camera_click.ogg:system/media/audio/ui/camera_click.ogg \
 	frameworks/base/data/sounds/effects/VideoRecord.ogg:system/media/audio/ui/VideoRecord.ogg \
 	frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml \
-	development/tools/emulator/system/camera/media_profiles.xml:system/etc/media_profiles.xml \
-	development/tools/emulator/system/camera/media_codecs.xml:system/etc/media_codecs.xml \
+	device/generic/goldfish/camera/media_profiles.xml:system/etc/media_profiles.xml \
+	device/generic/goldfish/camera/media_codecs.xml:system/etc/media_codecs.xml \
 	frameworks/native/data/etc/android.hardware.touchscreen.multitouch.jazzhand.xml:system/etc/permissions/android.hardware.touchscreen.multitouch.jazzhand.xml \
 	frameworks/native/data/etc/android.hardware.camera.autofocus.xml:system/etc/permissions/android.hardware.camera.autofocus.xml \
 	frameworks/av/media/libeffects/data/audio_effects.conf:system/etc/audio_effects.conf \
diff --git a/target/product/vbox_x86.mk b/target/product/vbox_x86.mk
index f0d4232..a492774 100644
--- a/target/product/vbox_x86.mk
+++ b/target/product/vbox_x86.mk
@@ -25,6 +25,12 @@
 $(call inherit-product, $(SRC_TARGET_DIR)/product/full_base.mk)
 $(call inherit-product, $(SRC_TARGET_DIR)/board/vbox_x86/device.mk)
 
+PRODUCT_PACKAGES += \
+       camera.vbox_x86 \
+       lights.vbox_x86 \
+       gps.vbox_x86 \
+       sensors.vbox_x86
+
 PRODUCT_NAME := vbox_x86
 PRODUCT_DEVICE := vbox_x86
 PRODUCT_MODEL := Full Android on x86 VirtualBox
diff --git a/tools/droiddoc/templates-sdk/assets/css/default.css b/tools/droiddoc/templates-sdk/assets/css/default.css
index 9f4edc6..916b1f8 100644
--- a/tools/droiddoc/templates-sdk/assets/css/default.css
+++ b/tools/droiddoc/templates-sdk/assets/css/default.css
@@ -1089,13 +1089,18 @@
 dd {
   margin:0 0 10px 30px;
 }
-dd p {
+dd p,
+dd pre,
+dd ul,
+dd ol,
+dd dl {
   margin:10px 0 0;
 }
 li p,
 li pre,
 li ul,
-li ol {
+li ol,
+li dl {
   margin-top:5px;
   margin-bottom:5px;
 }
@@ -1104,11 +1109,11 @@
 }
 pre, code {
     color: #060;
-    font: 14px/1.5 'courier new', courier, monospace;
+    font: 13px/1.5 monospace;
 }
 code {
     font-weight:bold;
-    font: 14px/14px 'courier new', courier, monospace;
+    font: 13px/14px monospace;
 }
 
 legend {
@@ -2473,7 +2478,7 @@
 
 p.code-caption {
   margin: 0 0 4px 0;
-  font: 13px/1.5 'courier new', courier, monospace;
+  font: 12px/1.5 monospace;
   color:#666;
 }
 
@@ -3964,7 +3969,7 @@
 .jspPane {
   position: absolute;
   overflow: hidden;
-  width:auto !important; /* to avoid cut-off api names in reference in horiz scroll */
+  width:100% !important; /* to avoid cut-off api names in reference in horiz scroll */
 }
 
 .jspVerticalBar {