Connect base.zip to mixed builds

Test: go test soong tests
Test: mixed_droid
Change-Id: Iaf1fbd1e7cde63892b01a9c9f4cd29ae69e2d6e3
diff --git a/apex/apex.go b/apex/apex.go
index 98722c4..72403f9 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1903,10 +1903,10 @@
 	apexType := a.properties.ApexType
 	switch apexType {
 	case imageApex:
+
 		// TODO(b/190817312): Generate the notice file from the apex rule.
 		a.htmlGzNotice = android.PathForBazelOut(ctx, "NOTICE.html.gz")
-		// TODO(b/239081457): Generate the bazel bundle module file from the apex rule.
-		a.bundleModuleFile = android.PathForBazelOut(ctx, a.Name()+apexType.suffix()+"-base.zip")
+		a.bundleModuleFile = android.PathForBazelOut(ctx, outputs.BundleFile)
 		a.nativeApisUsedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.SymbolsUsedByApex))
 		a.nativeApisBackedByModuleFile = android.ModuleOutPath(android.PathForBazelOut(ctx, outputs.BackingLibs))
 		// TODO(b/239084755): Generate the java api using.xml file from Bazel.
diff --git a/apex/apex_test.go b/apex/apex_test.go
index 9964ae4..7b4371f 100644
--- a/apex/apex_test.go
+++ b/apex/apex_test.go
@@ -9760,6 +9760,7 @@
 						ContainerKeyInfo:      []string{"container_cert", "container_private"},
 						SymbolsUsedByApex:     "foo_using.txt",
 						JavaSymbolsUsedByApex: "foo_using.xml",
+						BundleFile:            "apex_bundle.zip",
 
 						// unused
 						PackageName:  "pkg_name",
@@ -9804,4 +9805,13 @@
 	if w, g := "out/bazel/execroot/__main__/foo_using.xml", ab.javaApisUsedByModuleFile.String(); w != g {
 		t.Errorf("Expected output file %q, got %q", w, g)
 	}
+
+	mkData := android.AndroidMkDataForTest(t, result.TestContext, m)
+	var builder strings.Builder
+	mkData.Custom(&builder, "foo", "BAZEL_TARGET_", "", mkData)
+
+	data := builder.String()
+	if w := "ALL_MODULES.$(my_register_name).BUNDLE := out/bazel/execroot/__main__/apex_bundle.zip"; !strings.Contains(data, w) {
+		t.Errorf("Expected %q in androidmk data, but did not find %q", w, data)
+	}
 }
diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go
index b1b9089..b99780a 100644
--- a/bazel/cquery/request_type.go
+++ b/bazel/cquery/request_type.go
@@ -221,6 +221,7 @@
     "symbols_used_by_apex": info.symbols_used_by_apex.path,
     "java_symbols_used_by_apex": info.java_symbols_used_by_apex.path,
     "backing_libs": info.backing_libs.path,
+    "bundle_file": info.base_with_config_zip.path,
 })`
 }
 
@@ -235,6 +236,7 @@
 	SymbolsUsedByApex     string   `json:"symbols_used_by_apex"`
 	JavaSymbolsUsedByApex string   `json:"java_symbols_used_by_apex"`
 	BackingLibs           string   `json:"backing_libs"`
+	BundleFile            string   `json:"bundle_file"`
 }
 
 // ParseResult returns a value obtained by parsing the result of the request's Starlark function.