Support new attributes added in ApexInfo in mixed build.

Bug: 243748589
Test: CI
Change-Id: I6c9869464fe91ebf62811d92cf4403f2c7c9e8a9
diff --git a/apex/apex.go b/apex/apex.go
index 09cdc82..b039d0d 100644
--- a/apex/apex.go
+++ b/apex/apex.go
@@ -1854,10 +1854,10 @@
 	a.outputFile = a.outputApexFile
 	a.setCompression(ctx)
 
-	a.publicKeyFile = android.PathForBazelOut(ctx, outputs.BundleKeyPair[0])
-	a.privateKeyFile = android.PathForBazelOut(ctx, outputs.BundleKeyPair[1])
-	a.containerCertificateFile = android.PathForBazelOut(ctx, outputs.ContainerKeyPair[0])
-	a.containerPrivateKeyFile = android.PathForBazelOut(ctx, outputs.ContainerKeyPair[1])
+	a.publicKeyFile = android.PathForBazelOut(ctx, outputs.BundleKeyInfo[0])
+	a.privateKeyFile = android.PathForBazelOut(ctx, outputs.BundleKeyInfo[1])
+	a.containerCertificateFile = android.PathForBazelOut(ctx, outputs.ContainerKeyInfo[0])
+	a.containerPrivateKeyFile = android.PathForBazelOut(ctx, outputs.ContainerKeyInfo[1])
 	apexType := a.properties.ApexType
 	switch apexType {
 	case imageApex:
diff --git a/bazel/cquery/request_type.go b/bazel/cquery/request_type.go
index fa73fb2..febca5d 100644
--- a/bazel/cquery/request_type.go
+++ b/bazel/cquery/request_type.go
@@ -208,13 +208,16 @@
 //   - The function body should not be indented outside of its own scope.
 func (g getApexInfoType) StarlarkFunctionBody() string {
 	return `info = providers(target)["//build/bazel/rules/apex:apex.bzl%ApexInfo"]
+bundle_key_info = info.bundle_key_info
+container_key_info = info.container_key_info
 return json_encode({
     "signed_output": info.signed_output.path,
     "unsigned_output": info.unsigned_output.path,
     "provides_native_libs": [str(lib) for lib in info.provides_native_libs],
     "requires_native_libs": [str(lib) for lib in info.requires_native_libs],
-    "bundle_key_pair": [f.path for f in info.bundle_key_pair],
-    "container_key_pair": [f.path for f in info.container_key_pair]
+    "bundle_key_info": [bundle_key_info.public_key.path, bundle_key_info.private_key.path],
+    "container_key_info": [container_key_info.pem.path, container_key_info.pk8.path, container_key_info.key_name],
+    "package_name": info.package_name,
 })`
 }
 
@@ -223,8 +226,9 @@
 	UnsignedOutput   string   `json:"unsigned_output"`
 	ProvidesLibs     []string `json:"provides_native_libs"`
 	RequiresLibs     []string `json:"requires_native_libs"`
-	BundleKeyPair    []string `json:"bundle_key_pair"`
-	ContainerKeyPair []string `json:"container_key_pair"`
+	BundleKeyInfo    []string `json:"bundle_key_info"`
+	ContainerKeyInfo []string `json:"container_key_info"`
+	PackageName      string   `json:"package_name"`
 }
 
 // ParseResult returns a value obtained by parsing the result of the request's Starlark function.
diff --git a/bazel/cquery/request_type_test.go b/bazel/cquery/request_type_test.go
index 0f51cc0..42b42e1 100644
--- a/bazel/cquery/request_type_test.go
+++ b/bazel/cquery/request_type_test.go
@@ -145,16 +145,18 @@
 			input: `{"signed_output":"my.apex",` +
 				`"unsigned_output":"my.apex.unsigned",` +
 				`"requires_native_libs":["//bionic/libc:libc","//bionic/libdl:libdl"],` +
-				`"bundle_key_pair":["foo.pem","foo.privkey"],` +
-				`"container_key_pair":["foo.x509.pem", "foo.pk8"],` +
+				`"bundle_key_info":["foo.pem", "foo.privkey"],` +
+				`"container_key_info":["foo.x509.pem", "foo.pk8", "foo"],` +
+				`"package_name":"package.name",` +
 				`"provides_native_libs":[]}`,
 			expectedOutput: ApexCqueryInfo{
 				SignedOutput:     "my.apex",
 				UnsignedOutput:   "my.apex.unsigned",
 				RequiresLibs:     []string{"//bionic/libc:libc", "//bionic/libdl:libdl"},
 				ProvidesLibs:     []string{},
-				BundleKeyPair:    []string{"foo.pem", "foo.privkey"},
-				ContainerKeyPair: []string{"foo.x509.pem", "foo.pk8"},
+				BundleKeyInfo:    []string{"foo.pem", "foo.privkey"},
+				ContainerKeyInfo: []string{"foo.x509.pem", "foo.pk8", "foo"},
+				PackageName:      "package.name",
 			},
 		},
 	}