Merge "Remove "-mstackrealign" option from all x86 builds."
diff --git a/core/binary.mk b/core/binary.mk
index 7b77fb2..efb0db0 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -259,8 +259,10 @@
 my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS)
 endif # my_clang
 
-# If the global flag NATIVE_COVERAGE is set, my_native_coverage will be true
-# unless the module explicitly sets my_native_coverage := false.
+# To enable coverage for a given module, set LOCAL_NATIVE_COVERAGE=true and
+# build with NATIVE_COVERAGE=true in your enviornment. Note that the build
+# system is not sensitive to changes to NATIVE_COVERAGE, so you should do a
+# clean build of your module after toggling it.
 ifeq ($(NATIVE_COVERAGE),true)
     ifeq ($(my_native_coverage),true)
         # We can't currently generate coverage for clang binaries for two
@@ -276,8 +278,8 @@
         #    -no-integrated-as. Since most of the assembly in our tree is
         #    incompatible with clang's assembler, we can't turn off this flag.
         ifneq ($(my_clang),true)
-            my_target_global_cflags += --coverage
-            my_target_global_ldflags += --coverage
+            my_cflags += --coverage -O0
+            my_ldflags += --coverage
         endif
     endif
 else
diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk
index 91067f5..b7e40e3 100644
--- a/core/clang/TARGET_mips.mk
+++ b/core/clang/TARGET_mips.mk
@@ -9,6 +9,7 @@
   $(CLANG_CONFIG_EXTRA_ASFLAGS) \
   $(CLANG_CONFIG_TARGET_EXTRA_ASFLAGS) \
   $(CLANG_CONFIG_mips_EXTRA_ASFLAGS) \
+  -fPIC \
   -target $(CLANG_CONFIG_mips_TARGET_TRIPLE) \
   -B$(CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX)
 
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index 64aabda..02b189f 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -124,6 +124,7 @@
 LOCAL_RENDERSCRIPT_TARGET_API:=
 LOCAL_DEX_PREOPT:= # '',true,false,nostripping
 LOCAL_DEX_PREOPT_IMAGE_LOCATION:=
+LOCAL_DEX_PREOPT_FLAGS:=
 LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,nano,full
 LOCAL_PROTOC_FLAGS:=
 LOCAL_PROTO_JAVA_OUTPUT_PARAMS:=
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 6bf6b73..b61b180 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -98,5 +98,6 @@
 	--android-root=$(PRODUCT_OUT)/system \
 	--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
 	--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
-	--include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols
+	--include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \
+	$(PRIVATE_DEX_PREOPT_FLAGS)
 endef
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 6a9875b..90a3b5a 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -53,4 +53,5 @@
 		--image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \
 		--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
 		--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
-		--android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols
+		--android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate --no-include-debug-symbols \
+		$(PRODUCT_DEX_PREOPT_BOOT_FLAGS)
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 28282ec..d4484ca 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -11,7 +11,12 @@
     ifndef LOCAL_DEX_PREOPT # LOCAL_DEX_PREOPT undefined
       ifneq ($(filter $(TARGET_OUT)/%,$(my_module_path)),) # Installed to system.img.
         ifeq (,$(LOCAL_APK_LIBRARIES)) # LOCAL_APK_LIBRARIES empty
-          LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
+          # If we have product-specific config for this module?
+          ifeq (disable,$(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG))
+            LOCAL_DEX_PREOPT := false
+          else
+            LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
+          endif
         else # LOCAL_APK_LIBRARIES not empty
           LOCAL_DEX_PREOPT := nostripping
         endif # LOCAL_APK_LIBRARIES not empty
@@ -94,6 +99,14 @@
 endif  # boot jar
 
 ifdef built_odex
+ifndef LOCAL_DEX_PREOPT_FLAGS
+LOCAL_DEX_PREOPT_FLAGS := $(DEXPREOPT.$(TARGET_PRODUCT).$(LOCAL_MODULE).CONFIG)
+ifndef LOCAL_DEX_PREOPT_FLAGS
+LOCAL_DEX_PREOPT_FLAGS := $(PRODUCT_DEX_PREOPT_DEFAULT_FLAGS)
+endif
+endif
+$(built_odex): PRIVATE_DEX_PREOPT_FLAGS := $(LOCAL_DEX_PREOPT_FLAGS)
+
 # Use pattern rule - we may have multiple installed odex files.
 # Ugly syntax - See the definition get-odex-file-path.
 $(installed_odex) : $(dir $(LOCAL_INSTALLED_MODULE))%$(notdir $(word 1,$(installed_odex))) \
diff --git a/core/product.mk b/core/product.mk
index dbf49b5..7146b33 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -99,6 +99,10 @@
     PRODUCT_RUNTIMES \
     PRODUCT_BOOT_JARS \
     PRODUCT_DEX_PREOPT_IMAGE_IN_DATA \
+    PRODUCT_DEX_PREOPT_MODULE_CONFIGS \
+    PRODUCT_DEX_PREOPT_DEFAULT_FLAGS \
+    PRODUCT_DEX_PREOPT_BOOT_FLAGS \
+
 
 define dump-product
 $(info ==== $(1) ====)\
@@ -287,3 +291,14 @@
 define add-to-product-copy-files-if-exists
 $(if $(wildcard $(word 1,$(subst :, ,$(1)))),$(1))
 endef
+
+# whitespace placeholder when we record module's dex-preopt config.
+_PDPMC_SP_PLACE_HOLDER := |@SP@|
+# Set up dex-preopt config for a module.
+# $(1) list of module names
+# $(2) the modules' dex-preopt config
+define add-product-dex-preopt-module-config
+$(eval _c := $(subst $(space),$(_PDPMC_SP_PLACE_HOLDER),$(strip $(2))))\
+$(eval PRODUCT_DEX_PREOPT_MODULE_CONFIGS += \
+  $(foreach m,$(1),$(m)=$(_c)))
+endef
diff --git a/core/product_config.mk b/core/product_config.mk
index 9468362..e9c6d32 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -413,3 +413,21 @@
 # If there is no room in /system for the image, place it in /data
 PRODUCT_DEX_PREOPT_IMAGE_IN_DATA := \
     $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_IMAGE_IN_DATA))
+
+PRODUCT_DEX_PREOPT_DEFAULT_FLAGS := \
+    $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_DEFAULT_FLAGS))
+PRODUCT_DEX_PREOPT_BOOT_FLAGS := \
+    $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_BOOT_FLAGS))
+# Resolve and setup per-module dex-preopot configs.
+PRODUCT_DEX_PREOPT_MODULE_CONFIGS := \
+    $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEX_PREOPT_MODULE_CONFIGS))
+# If a module has multiple setups, the first takes precedence.
+_pdpmc_modules :=
+$(foreach c,$(PRODUCT_DEX_PREOPT_MODULE_CONFIGS),\
+  $(eval m := $(firstword $(subst =,$(space),$(c))))\
+  $(if $(filter $(_pdpmc_modules),$(m)),,\
+    $(eval _pdpmc_modules += $(m))\
+    $(eval cf := $(patsubst $(m)=%,%,$(c)))\
+    $(eval cf := $(subst $(_PDPMC_SP_PLACE_HOLDER),$(space),$(cf)))\
+    $(eval DEXPREOPT.$(TARGET_PRODUCT).$(m).CONFIG := $(cf))))
+_pdpmc_modules :=
diff --git a/tools/droiddoc/templates-sac/assets/css/default.css b/tools/droiddoc/templates-sac/assets/css/default.css
index 0d9e601..c1a0c19 100644
--- a/tools/droiddoc/templates-sac/assets/css/default.css
+++ b/tools/droiddoc/templates-sac/assets/css/default.css
@@ -1016,12 +1016,13 @@
 }
 h1 {
     color:#333;
-    font-size: 22px;
-    margin: 20px 0 20px;
+    font-size: 34px;
+    margin: 36px 0 27px;
     padding:0 0 10px;
+    font-weight:300;
 }
 h1, h2 {
-    line-height: 32px;
+    line-height: 30px;
 }
 h1.short {
   margin-right:320px;
@@ -1030,35 +1031,41 @@
   margin-right:320px;
 }
 h1.super {
-    font-size: 37px;  
+    font-size: 37px;
 }
 h2 {
     color:#333;
-    font-size: 20px;
-    margin: 20px 0 20px;
+    font-size: 26px;
+    margin: 32px 0 20px;
     padding:0;
+    font-weight:300;
 }
 h3 {
     color:#333;
-    font-size: 18px;
+    font-size: 21px;
+    font-weight:400;
+    margin:21px 0 14px 0;
 }
 h3, h4 {
-    color:#333;
-    line-height: 20px;
-    margin: 10px 0;
+    line-height: 21px;
 }
 h4 {
-  font-size: 16px;
+  font-size: 18px;
+  margin: 12px 0;
+  font-weight:500;
 }
 h5 {
-  font-size: 14px;  
+  font-size: 14px;
 }
 h5, h6 {
   margin: 5px 0;
 }
 h6 {
-  font-size: 12px;  
+  font-size: 12px;
 }
+
+
+
 hr { /* applied to the bottom of h2 elements */
   height: 1px;
   margin: 5px 0 20px;