Bugfix for LOCAL_CERTIFICATE of AutogeneratedRuntimeResourceOverlay

LOCAL_CERTIFICATE of these modules are currently set to `PRESIGNED`,
since soong generates the build rules to sign the apk.

However, this is an incorrect interpretation of `PRESIGNED`. This
keyword means that the apk was signed with a release key, and not dev
keys. Since Soong signs the autogenerated rros with dev keys, drop
`PRESIGNED` from `LOCAL_CERTIFICATE` and replace it with the dev key
string.

Test: verified that `LOCAL_CERTIFICATE` of
`Settings__aosp_cf_x86_64_phone__auto_generated_rro_vendor` in the
autogenerated Android.mk is no longer PRESIGNED.

Bug: 375277835
(cherry picked from https://android-review.googlesource.com/q/commit:af8a3f5eaf70b817e43ab8e0a4908a7a5025c85f)
Merged-In: I024f88f9ee887323e93df8338af5f8b089025b93
Change-Id: I024f88f9ee887323e93df8338af5f8b089025b93
diff --git a/java/androidmk.go b/java/androidmk.go
index b6bab53..039e847 100644
--- a/java/androidmk.go
+++ b/java/androidmk.go
@@ -408,7 +408,7 @@
 		Include:    "$(BUILD_SYSTEM)/soong_app_prebuilt.mk",
 		ExtraEntries: []android.AndroidMkExtraEntriesFunc{
 			func(ctx android.AndroidMkExtraEntriesContext, entries *android.AndroidMkEntries) {
-				entries.SetString("LOCAL_CERTIFICATE", "PRESIGNED") // The apk will be signed by soong
+				entries.SetString("LOCAL_CERTIFICATE", a.certificate.AndroidMkString())
 			},
 		},
 	}}
diff --git a/java/rro.go b/java/rro.go
index d277e4a..ab4fafa 100644
--- a/java/rro.go
+++ b/java/rro.go
@@ -290,7 +290,8 @@
 
 	properties AutogenRuntimeResourceOverlayProperties
 
-	outputFile android.Path
+	certificate Certificate
+	outputFile  android.Path
 }
 
 type AutogenRuntimeResourceOverlayProperties struct {
@@ -380,7 +381,8 @@
 		return
 	}
 	// Sign the built package
-	_, certificates := processMainCert(a.ModuleBase, "", nil, ctx)
+	var certificates []Certificate
+	a.certificate, certificates = processMainCert(a.ModuleBase, "", nil, ctx)
 	signed := android.PathForModuleOut(ctx, "signed", a.Name()+".apk")
 	SignAppPackage(ctx, signed, a.exportPackage, certificates, nil, nil, "")
 	a.outputFile = signed