Rollback to the legacy way of computing boot image locations.

This fixes JIT-zygote builds (b/146462581). The fix is a workaround:
boot image location is computed from boot image filename instead of
using the pre-computed location from the module dexpreopt config.

Currently parts of the dexpreopt module config use boot image name
that is hard-coded in Makefiles, and other parts use boot image name
that is generated by Soong. This is exacerbated by the fact that
"default" boot image config in JIT-zygote builds consists partly of
the "apex" boot image, and partly of "boot" boot image.

Test: walleye_jitzygote-userdebug builds.

Bug: 146462581
Change-Id: I9a91fc48e54d7d43abec2cb2b5a11e3581db380b
diff --git a/dexpreopt/dexpreopt.go b/dexpreopt/dexpreopt.go
index ee04dfd..fc1bae1 100644
--- a/dexpreopt/dexpreopt.go
+++ b/dexpreopt/dexpreopt.go
@@ -222,6 +222,14 @@
 
 	invocationPath := odexPath.ReplaceExtension(ctx, "invocation")
 
+	// TODO(skvadrik): fix this to use boot image location in the module config (currently it is broken
+	// in JIT-zygote builds, because "default" boot image is hard-coded in parts of the module config).
+	bootImage := module.DexPreoptImages[archIdx]
+	var bootImageLocation string
+	if bootImage != nil {
+		bootImageLocation = PathToLocation(bootImage, arch)
+	}
+
 	// The class loader context using paths in the build
 	var classLoaderContextHost android.Paths
 
@@ -349,7 +357,7 @@
 		Flag("--runtime-arg").FlagWithList("-Xbootclasspath-locations:", module.PreoptBootClassPathDexLocations, ":").
 		Flag("${class_loader_context_arg}").
 		Flag("${stored_class_loader_context_arg}").
-		FlagWithArg("--boot-image=", strings.Join(module.DexPreoptImageLocations, ":")).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
+		FlagWithArg("--boot-image=", bootImageLocation).Implicits(module.DexPreoptImagesDeps[archIdx].Paths()).
 		FlagWithInput("--dex-file=", module.DexPath).
 		FlagWithArg("--dex-location=", dexLocationArg).
 		FlagWithOutput("--oat-file=", odexPath).ImplicitOutput(vdexPath).