Use d8 when on eng builds

This is consistent with all of the other ways that eng builds are
faster, but do not match the expected performance of user or userdebug
builds.

We still use r8 if a module has `optimize: { enabled: true,}`.

Bug: b/374975543
Test: manual, TH
Change-Id: I28c6de4472f4df1f791758294d45b67acc0a7b7c
diff --git a/java/java.go b/java/java.go
index dd9f852..07e38a1 100644
--- a/java/java.go
+++ b/java/java.go
@@ -670,12 +670,12 @@
 		ctx.AddVariationDependencies(nil, bootClasspathTag, sdkDep.bootclasspath...)
 		ctx.AddVariationDependencies(nil, java9LibTag, sdkDep.java9Classpath...)
 		ctx.AddVariationDependencies(nil, sdkLibTag, sdkDep.classpath...)
-		if d.effectiveOptimizeEnabled() && sdkDep.hasStandardLibs() {
+		if d.effectiveOptimizeEnabled(ctx) && sdkDep.hasStandardLibs() {
 			ctx.AddVariationDependencies(nil, proguardRaiseTag,
 				config.LegacyCorePlatformBootclasspathLibraries...,
 			)
 		}
-		if d.effectiveOptimizeEnabled() && sdkDep.hasFrameworkLibs() {
+		if d.effectiveOptimizeEnabled(ctx) && sdkDep.hasFrameworkLibs() {
 			ctx.AddVariationDependencies(nil, proguardRaiseTag, config.FrameworkLibraries...)
 		}
 	}