Build: Only preopt boot images in eng builds

As a middle way between full preopt/high performance/long builds,
and no preopt/low performance/fast turnaround, preopt only the
boot image in eng builds.

Bug: 26794212
Change-Id: I4a2692f3ce84823cd40c6b7d672fd73257739ef8
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 6499b63..2941b73 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -24,6 +24,11 @@
 ifeq ($(HOST_OS),linux)
   WITH_DEXPREOPT_PIC ?= true
   WITH_DEXPREOPT ?= true
+# For an eng build only pre-opt the boot image. This gives reasonable performance and still
+# allows a simple workflow: building in frameworks/base and syncing.
+  ifeq (eng,$(TARGET_BUILD_VARIANT))
+    WITH_DEXPREOPT_BOOT_IMG_ONLY ?= true
+  endif
 endif
 
 # $(1): the .jar or .apk to remove classes.dex