Revert "Move the Once cache for dexpreopt.GlobalConfig into the ..."

Revert submission 1211982-dex2oat-soong-dep

Reason for revert: Build failures. See b/148312086.

Reverted Changes:
Ibc427a9a8: Make dex2oat(d) visible for use as implicit dexpre...
I71df11c1e: Move the Once cache for dexpreopt.GlobalConfig int...
I38317f2d5: Get the dex2oat host tool path from module depende...
I440a09dba: Separate dexpreopt.GlobalSoongConfig to allow inde...

Bug: 148312086
Bug: 145934348
Exempt-From-Owner-Approval: Plain revert
Change-Id: I6b656afb5feaad70d958b9d38b6c6eab7b03fba1
diff --git a/java/dexpreopt_bootjars.go b/java/dexpreopt_bootjars.go
index 0082d03..a497b08 100644
--- a/java/dexpreopt_bootjars.go
+++ b/java/dexpreopt_bootjars.go
@@ -162,7 +162,7 @@
 }
 
 func skipDexpreoptBootJars(ctx android.PathContext) bool {
-	if dexpreopt.GetGlobalConfig(ctx).DisablePreopt {
+	if dexpreoptGlobalConfig(ctx).DisablePreopt {
 		return true
 	}
 
@@ -195,7 +195,7 @@
 	files := artBootImageConfig(ctx).imagesDeps
 
 	// For JIT-zygote config, also include dexpreopt files for the primary JIT-zygote image.
-	if dexpreopt.GetGlobalConfig(ctx).UseApexImage {
+	if dexpreoptGlobalConfig(ctx).UseApexImage {
 		for arch, paths := range artJZBootImageConfig(ctx).imagesDeps {
 			files[arch] = append(files[arch], paths...)
 		}
@@ -213,7 +213,7 @@
 	d.dexpreoptConfigForMake = android.PathForOutput(ctx, ctx.Config().DeviceName(), "dexpreopt.config")
 	writeGlobalConfigForMake(ctx, d.dexpreoptConfigForMake)
 
-	global := dexpreopt.GetGlobalConfig(ctx)
+	global := dexpreoptGlobalConfig(ctx)
 
 	// Skip recompiling the boot image for the second sanitization phase. We'll get separate paths
 	// and invalidate first-stage artifacts which are crucial to SANITIZE_LITE builds.
@@ -305,7 +305,7 @@
 	arch android.ArchType, profile android.Path, missingDeps []string) android.WritablePaths {
 
 	globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
-	global := dexpreopt.GetGlobalConfig(ctx)
+	global := dexpreoptGlobalConfig(ctx)
 
 	symbolsDir := image.symbolsDir.Join(ctx, image.installSubdir, arch.String())
 	symbolsFile := symbolsDir.Join(ctx, image.stem+".oat")
@@ -444,7 +444,7 @@
 
 func bootImageProfileRule(ctx android.SingletonContext, image *bootImage, missingDeps []string) android.WritablePath {
 	globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
-	global := dexpreopt.GetGlobalConfig(ctx)
+	global := dexpreoptGlobalConfig(ctx)
 
 	if global.DisableGenerateProfile || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
 		return nil
@@ -499,7 +499,7 @@
 
 func bootFrameworkProfileRule(ctx android.SingletonContext, image *bootImage, missingDeps []string) android.WritablePath {
 	globalSoong := dexpreopt.GetCachedGlobalSoongConfig(ctx)
-	global := dexpreopt.GetGlobalConfig(ctx)
+	global := dexpreoptGlobalConfig(ctx)
 
 	if global.DisableGenerateProfile || ctx.Config().IsPdkBuild() || ctx.Config().UnbundledBuild() {
 		return nil
@@ -587,7 +587,7 @@
 }
 
 func writeGlobalConfigForMake(ctx android.SingletonContext, path android.WritablePath) {
-	data := dexpreopt.GetGlobalConfigRawData(ctx)
+	data := dexpreoptGlobalConfigRaw(ctx).data
 
 	ctx.Build(pctx, android.BuildParams{
 		Rule:   android.WriteFile,