Enable art for user builds

Bug: 10069754
Change-Id: Iaaff33a97bd7b68b2e8d84cd0034b15dde8a4316
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 77b239b..e2e76b8 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -56,7 +56,9 @@
 
 $(_dbj_jar_no_dex) : $(_dbj_src_jar) | $(ACP) $(AAPT)
 	$$(call copy-file-to-target)
+ifneq ($(DEX_PREOPT_DEFAULT),nostripping)
 	$$(call dexpreopt-remove-classes.dex,$$@)
+endif
 
 $(eval _dbj_jar :=)
 $(eval _dbj_odex :=)
diff --git a/core/java_library.mk b/core/java_library.mk
index 9dbd79b..4c6b652 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -40,7 +40,7 @@
 ifeq (,$(TARGET_BUILD_APPS))
 ifeq (,$(LOCAL_APK_LIBRARIES))
 ifndef LOCAL_DEX_PREOPT
-LOCAL_DEX_PREOPT := true
+LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
 endif
 endif
 endif
diff --git a/core/package.mk b/core/package.mk
index fd72cce..551028c 100644
--- a/core/package.mk
+++ b/core/package.mk
@@ -153,7 +153,7 @@
 ifeq (,$(LOCAL_APK_LIBRARIES))
 ifneq (,$(LOCAL_SRC_FILES))
 ifndef LOCAL_DEX_PREOPT
-LOCAL_DEX_PREOPT := true
+LOCAL_DEX_PREOPT := $(DEX_PREOPT_DEFAULT)
 endif
 endif
 endif
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 1915e3c..02cc815 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -59,8 +59,6 @@
 PRODUCT_BOOT_JARS := core:conscrypt:okhttp:core-junit:bouncycastle:ext:framework:framework2:android.policy:services:apache-xml:webviewchromium
 
 PRODUCT_RUNTIMES := runtime_libdvm_default
-ifneq (,$(filter userdebug eng, $(TARGET_BUILD_VARIANT)))
-    PRODUCT_RUNTIMES += runtime_libart
-endif
+PRODUCT_RUNTIMES += runtime_libart
 
 $(call inherit-product, $(SRC_TARGET_DIR)/product/base.mk)
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 1a7c925..5fddc3f 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -28,4 +28,7 @@
         core-libart-hostdex
 endif
 
+# We currently don't suport DEX_PREOPT for art
+DEX_PREOPT_DEFAULT := nostripping
+
 include $(SRC_TARGET_DIR)/product/runtime_common.mk
diff --git a/target/product/runtime_libdvm.mk b/target/product/runtime_libdvm.mk
index e7647b8..42e86ed 100644
--- a/target/product/runtime_libdvm.mk
+++ b/target/product/runtime_libdvm.mk
@@ -27,4 +27,9 @@
         core-hostdex
 endif
 
+# If runtime_libart has disabled, do not override
+ifndef DEX_PREOPT_DEFAULT
+DEX_PREOPT_DEFAULT := true
+endif
+
 include $(SRC_TARGET_DIR)/product/runtime_common.mk